Raspberry Pi PPP dial-up

From Waveshare Wiki
Jump to: navigation, search

PPP dial

  • Switch to root account
sudo su
  • Install ppp
sudo apt-get install ppp
  • Enter the /etc/ppp/peers directory
cd /etc/ppp/peers
  • Create gprs file
sudo nano gprs
  • Copy the text below to gprs

(If you need UART dial-up, change ttyS0 to ttyUSB2) The content is as follows:

user "[email protected]"
#connect "/usr/sbin/chat -v -f /etc/chatscripts/pap -T ********"
connect "/usr/sbin/chat -v -f /etc/chatscripts/gprs"
#/dev/modem
/dev/ttyUSB2
#/dev/ttyS0     
# Speed of the serial line.
115200
nocrtscts
debug
nodetach
ipcp-accept-local
ipcp-accept-remote
# Assumes that your IP address is allocated dynamically by the ISP.
noipdefault
# Try to get the name server addresses from the ISP.
usepeerdns
# Use this connection as the default route.
defaultroute
# Makes pppd "dial again" when the connection is lost.
persist
# Do not ask the remote to authenticate.
noauth
  • PPP dial
pppd call gprs &
  • View ppp0 network
ifconfig
  • Test the Internet
ping -I ppp0 www.baidu.com

20210106115457156.png

Auto-start PPP dialing after power-on (optional)

  • Edit the test.sh file
sudo nano test.sh
  • Copy the following text to tesh.sh
sudo su
# sleep 1m
cd /etc/ppp/peers
pppd call gprs &
  • Grant executable permissions to script files (example: test.sh, path: ./home/pi/test.sh)
sudo chmod 777 test.sh
  • Open the /etc/rc.local file
sudo nano /etc/rc.local
  • Add the execution script command in the /etc/rc.local file (the line above the statement exit 0)
bash ./home/pi/test.sh
  • Then execute the restart script
./test.sh