Skip to content

Instantly share code, notes, and snippets.

@RobertLucian
Created August 29, 2018 20:25
Show Gist options
  • Save RobertLucian/0881a8b6ebb01dd8fcf84b3fb925e723 to your computer and use it in GitHub Desktop.
Save RobertLucian/0881a8b6ebb01dd8fcf84b3fb925e723 to your computer and use it in GitHub Desktop.
pppd basic creator for EC25-E 4G module
#!/bin/bash
echo "creating directories"
mkdir -p /etc/chatscripts
mkdir -p /etc/ppp/peers
echo "creating script file : /etc/chatscripts/quectel-chat-connect"
echo "
ABORT \"BUSY\"
ABORT \"NO CARRIER\"
ABORT \"NO DIALTONE\"
ABORT \"ERROR\"
ABORT \"NO ANSWER\"
TIMEOUT 30
\"\" AT
OK ATE0
OK ATI;+CSUB;+CSQ;+COPS?;+CGREG?;&D2
# Insert the APN provided by your network operator, default apn is $1
OK AT+CGDCONT=1,\"IP\",\"\\T\",,0,0
OK ATD*99#
CONNECT" > /etc/chatscripts/quectel-chat-connect
echo "creating script file : /etc/chatscripts/quectel-chat-disconnect"
echo "
ABORT \"ERROR\"
ABORT \"NO DIALTONE\"
SAY \"\nSending break to the modem\n\"
"" +++
"" +++
"" +++
SAY \"\nGoodbay\n\"" > /etc/chatscripts/quectel-chat-disconnect
echo "creating script file : /etc/ppp/peers/gprs"
echo "
/dev/$2 115200
# The chat script, customize your APN in this file
connect 'chat -s -v -f /etc/chatscripts/quectel-chat-connect -T $1'
# The close script
disconnect 'chat -s -v -f /etc/chatscripts/quectel-chat-disconnect'
# Hide password in debug messages
hide-password
# The phone is not required to authenticate
noauth
# Debug info from pppd
debug
# If you want to use the HSDPA link as your gateway
defaultroute
# pppd must not propose any IP address to the peer
noipdefault
# No ppp compression
novj
novjccomp
noccp
ipcp-accept-local
ipcp-accept-remote
local
# For sanity, keep a lock on the serial line
lock
modem
dump
nodetach
# Hardware flow control
nocrtscts
remotename 3gppp
ipparam 3gppp
ipcp-max-failure 30
# Ask the peer for up to 2 DNS server addresses
usepeerdns" > /etc/ppp/peers/gprs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment