Setting up the PPP connection for Sixfab Shield/HAT

PPP is a data layer communication protocol that is established through the serial port of the modem. These Serial port communication could be either the UART(/dev/ttyS0) or the serial exposed to USB(/dev/ttyUSB3). This serial is also used for both modem commands (AT commands) and responses. This connection is established by dial-up (ATD*99#).

PPP is easy to establish, widely used protocol, and flexible with the devices. PPP may show a drop of the connection while using the AT command set for other functionality of modem.

The LTE radio protocol has native support of TCP/IP and IPv6, so there is no need to actually wrap TCP/IP into PPP over the radio interface. The PPP protocol is just used between the computer and the modem to make the connection look like a legacy dial-up modem-based network connection.

Hardware Setup

It is important to properly setup your hardware before you get started.

Software Setup

  1. Download the installer file by the following command.
wget https://raw.githubusercontent.com/sixfab/Sixfab_PPP_Installer/\
master/ppp_installer/install.sh
  1. Change the permission of the installation file.
sudo chmod +x install.sh
  1. Now install the script. It will ask several questions, just answer them accordingly to complete the installation process. The questions are:
sudo ./install.sh

Please choose your Sixfab Shields/HATs
You will be offered to choose among the mentioned shields/HATs. Then it will fetch the required scripts for you.

[email protected]:~ $ sudo ./install.sh Please choose your Sixfab Shield/HAT: 1: GSM/GPRS Shield 2: 3G, 4G/LTE Base Shield 3: Cellular IoT App Shield 4: Cellular IoT HAT 5: Tracker HAT 6: 3G/4G Base HAT

What is your carrier APN?
It will then ask for APN. Type in your APN and then press ENTER. For me, it is super.

[email protected]:~ $ sudo ./install.sh ... ... ... ppp and wiringpi (gpio tool) install Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: libpcap0.8 The following NEW packages will be installed: libpcap0.8 ppp wiringpi 0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded. Need to get 489 kB of archives. After this operation, 1107 kB of additional disk space will be used. Get:1 http://mirror.as43289.net/raspbian/raspbian buster/main armhf libpcap0.8 armhf 1.8.1-6 [124 kB] Get:2 http://mirror.as43289.net/raspbian/raspbian buster/main armhf ppp armhf 2.4.7-2+4.1+deb10u1 [312 kB] Get:3 http://archive.raspberrypi.org/debian buster/main armhf wiringpi armhf 2.50 [52.9 kB] Fetched 489 kB in 11s (42.7 kB/s) Selecting previously unselected package libpcap0.8:armhf. (Reading database ... 39891 files and directories currently installed.) Preparing to unpack .../libpcap0.8_1.8.1-6_armhf.deb ... Unpacking libpcap0.8:armhf (1.8.1-6) ... Selecting previously unselected package ppp. Preparing to unpack .../ppp_2.4.7-2+4.1+deb10u1_armhf.deb ... Unpacking ppp (2.4.7-2+4.1+deb10u1) ... Selecting previously unselected package wiringpi. Preparing to unpack .../wiringpi_2.50_armhf.deb ... Unpacking wiringpi (2.50) ... Setting up libpcap0.8:armhf (1.8.1-6) ... Setting up ppp (2.4.7-2+4.1+deb10u1) ... Created symlink /etc/systemd/system/multi-user.target.wants/pppd-dns.service → /lib/systemd/system/pppd-dns.service. Setting up wiringpi (2.50) ... Processing triggers for systemd (241-7~deb10u4+rpi1) ... Processing triggers for man-db (2.8.5-2) ... Processing triggers for libc-bin (2.28-10+rpi1) ... What is your carrier APN? _

Does your carrier need username and password?

[email protected]:~ $ sudo ./install.sh ... ... ... Selecting previously unselected package libpcap0.8:armhf. (Reading database ... 39891 files and directories currently installed.) Preparing to unpack .../libpcap0.8_1.8.1-6_armhf.deb ... Unpacking libpcap0.8:armhf (1.8.1-6) ... Selecting previously unselected package ppp. Preparing to unpack .../ppp_2.4.7-2+4.1+deb10u1_armhf.deb ... Unpacking ppp (2.4.7-2+4.1+deb10u1) ... Selecting previously unselected package wiringpi. Preparing to unpack .../wiringpi_2.50_armhf.deb ... Unpacking wiringpi (2.50) ... Setting up libpcap0.8:armhf (1.8.1-6) ... Setting up ppp (2.4.7-2+4.1+deb10u1) ... Created symlink /etc/systemd/system/multi-user.target.wants/pppd-dns.service → /lib/systemd/system/pppd-dns.service. Setting up wiringpi (2.50) ... Processing triggers for systemd (241-7~deb10u4+rpi1) ... Processing triggers for man-db (2.8.5-2) ... Processing triggers for libc-bin (2.28-10+rpi1) ... What is your carrier APN? super Does your carrier need username and password? [Y/n] n

Enter your communication PORT name
In this step, you will enter your PORT. Please see table 1.

[email protected]:~ $ sudo ./install.sh ... ... ... Selecting previously unselected package libpcap0.8:armhf. (Reading database ... 39891 files and directories currently installed.) Preparing to unpack .../libpcap0.8_1.8.1-6_armhf.deb ... Unpacking libpcap0.8:armhf (1.8.1-6) ... Selecting previously unselected package ppp. Preparing to unpack .../ppp_2.4.7-2+4.1+deb10u1_armhf.deb ... Unpacking ppp (2.4.7-2+4.1+deb10u1) ... Selecting previously unselected package wiringpi. Preparing to unpack .../wiringpi_2.50_armhf.deb ... Unpacking wiringpi (2.50) ... Setting up libpcap0.8:armhf (1.8.1-6) ... Setting up ppp (2.4.7-2+4.1+deb10u1) ... Created symlink /etc/systemd/system/multi-user.target.wants/pppd-dns.service → /lib/systemd/system/pppd-dns.service. Setting up wiringpi (2.50) ... Processing triggers for systemd (241-7~deb10u4+rpi1) ... Processing triggers for man-db (2.8.5-2) ... Processing triggers for libc-bin (2.28-10+rpi1) ... What is your carrier APN? super Does your carrier need username and password? [Y/n] n What is your device communication PORT? (ttyS0/ttyUSB3/etc.) ttyUSB3

Do you want to activate auto-connect/reconnect service at Raspberry Pi boot up?
This option allows you to connect to the Internet via your HAT automatically when your Raspberry Pi starts.

[email protected]:~ $ sudo ./install.sh ... ... ... Selecting previously unselected package libpcap0.8:armhf. (Reading database ... 39891 files and directories currently installed.) Preparing to unpack .../libpcap0.8_1.8.1-6_armhf.deb ... Unpacking libpcap0.8:armhf (1.8.1-6) ... Selecting previously unselected package ppp. Preparing to unpack .../ppp_2.4.7-2+4.1+deb10u1_armhf.deb ... Unpacking ppp (2.4.7-2+4.1+deb10u1) ... Selecting previously unselected package wiringpi. Preparing to unpack .../wiringpi_2.50_armhf.deb ... Unpacking wiringpi (2.50) ... Setting up libpcap0.8:armhf (1.8.1-6) ... Setting up ppp (2.4.7-2+4.1+deb10u1) ... Created symlink /etc/systemd/system/multi-user.target.wants/pppd-dns.service → /lib/systemd/system/pppd-dns.service. Setting up wiringpi (2.50) ... Processing triggers for systemd (241-7~deb10u4+rpi1) ... Processing triggers for man-db (2.8.5-2) ... Processing triggers for libc-bin (2.28-10+rpi1) ... What is your carrier APN? super Does your carrier need username and password? [Y/n] n What is your device communication PORT? (ttyS0/ttyUSB3/etc.) ttyUSB3 Do you want to activate auto connect/reconnect service at R.Pi boot up? [Y/n] n To connect to internet run "sudo pon" and to disconnect run "sudo poff" Press ENTER key to reboot

If you want to connect to the Internet automatically type y else N. If you have selected N then you will need to run sudo pon to connect to the internet and sudo poff. to stop it. Make sure your module is powered up.

[email protected]:~ $ sudo pon pppd options in effect: debug # (from /etc/ppp/peers/provider) updetach # (from /etc/ppp/peers/provider) persist # (from /etc/ppp/peers/provider) dump # (from /etc/ppp/peers/provider) noauth # (from /etc/ppp/peers/provider) remotename 3gppp # (from /etc/ppp/peers/provider) /dev/ttyUSB3 # (from /etc/ppp/peers/provider) 115200 # (from /etc/ppp/peers/provider) lock # (from /etc/ppp/peers/provider) connect chat -s -v -f /etc/chatscripts/chat-connect -T super # (from /etc/ppp/peers/provider) disconnect chat -s -v -f /etc/chatscripts/chat-disconnect # (from /etc/ppp/peers/provider) nocrtscts # (from /etc/ppp/peers/provider) modem # (from /etc/ppp/peers/provider) asyncmap 0 # (from /etc/ppp/options) lcp-echo-failure 4 # (from /etc/ppp/options) lcp-echo-interval 30 # (from /etc/ppp/options) hide-password # (from /etc/ppp/peers/provider) novj # (from /etc/ppp/peers/provider) novjccomp # (from /etc/ppp/peers/provider) ipcp-accept-local # (from /etc/ppp/peers/provider) ipcp-accept-remote # (from /etc/ppp/peers/provider) ipparam 3gppp # (from /etc/ppp/peers/provider) noipdefault # (from /etc/ppp/peers/provider) ipcp-max-failure 30 # (from /etc/ppp/peers/provider) defaultroute # (from /etc/ppp/peers/provider) usepeerdns # (from /etc/ppp/peers/provider) noccp # (from /etc/ppp/peers/provider) noipx # (from /etc/ppp/options) abort on (BUSY) abort on (NO CARRIER) abort on (NO DIALTONE) abort on (ERROR) abort on (NO ANSWER) timeout set to 30 seconds send (AT^M) expect (OK) ^M OK -- got it send (ATE0^M) expect (OK) ^M ^M OK -- got it send (ATI;+CSUB;+CSQ;+COPS?;+CGREG?;&D2^M) expect (OK) ^M ^M Quectel^M EC25^M Revision: EC25EFAR06A04M4G^M ^M SubEdition: V05^M ^M +CSQ: 20,99^M ^M +COPS: 0,0,"Twilio",7^M ^M +CGREG: 0,5^M ^M OK -- got it send (AT+CGDCONT=1,"IP","super",,0,0^M) expect (OK) ^M ^M OK -- got it send (ATD*99#^M) expect (CONNECT) ^M ^M CONNECT -- got it Script chat -s -v -f /etc/chatscripts/chat-connect -T super finished (pid 1235), status = 0x0 Serial connection established. using channel 3 Using interface ppp0 Connect: ppp0 <--> /dev/ttyUSB3 sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xe68b30d3> <pcomp> <accomp>] rcvd [LCP ConfReq id=0x0 <asyncmap 0x0> <auth chap MD5> <magic 0x6462fc5e> <pcomp> <accomp>] No auth is possible sent [LCP ConfRej id=0x0 <auth chap MD5>] rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0xe68b30d3> <pcomp> <accomp>] rcvd [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x6462fc5e> <pcomp> <accomp>] sent [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0x6462fc5e> <pcomp> <accomp>] sent [LCP EchoReq id=0x0 magic=0xe68b30d3] sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>] rcvd [LCP DiscReq id=0x2 magic=0x6462fc5e] rcvd [LCP EchoRep id=0x0 magic=0x6462fc5e e6 8b 30 d3] rcvd [IPCP ConfReq id=0x0] sent [IPCP ConfNak id=0x0 <addr 0.0.0.0>] rcvd [IPCP ConfNak id=0x1 <addr 100.64.29.57> <ms-dns1 8.8.8.8> <ms-dns2 8.8.4.4>] sent [IPCP ConfReq id=0x2 <addr 100.64.29.57> <ms-dns1 8.8.8.8> <ms-dns2 8.8.4.4>] rcvd [IPCP ConfReq id=0x1] sent [IPCP ConfAck id=0x1] rcvd [IPCP ConfAck id=0x2 <addr 100.64.29.57> <ms-dns1 8.8.8.8> <ms-dns2 8.8.4.4>] Could not determine remote IP address: defaulting to 10.64.64.64 not replacing default route to wlan0 [192.168.1.1] local IP address 100.64.29.57 remote IP address 10.64.64.64 primary DNS address 8.8.8.8 secondary DNS address 8.8.4.4

👍

Module Configuration

Before running the PPP/QMI make sure the module is configured to the right settings.
AT+QCFG="usbnet" should return 0, otherwise,
send
AT+QCFG="usbnet",0
then reboot the module,
AT+CFUN=1,1

For sending AT commands, you may check the Sending AT Commands Tutorial.

[email protected]:~ $ ifconfig ppp0 ppp0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1500 inet 100.64.140.89 netmask 255.255.255.255 destination 10.64.64.64 ppp txqueuelen 3 (Point-to-Point Protocol) RX packets 18 bytes 1392 (1.3 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 20 bytes 1395 (1.3 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[email protected]:~ $ ping -I ppp0 -c 5 sixfab.com PING sixfab.com (104.26.9.221) from 100.64.29.57 ppp0: 56(84) bytes of data. 64 bytes from 104.26.9.221 (104.26.9.221): icmp_seq=1 ttl=53 time=316 ms 64 bytes from 104.26.9.221 (104.26.9.221): icmp_seq=2 ttl=53 time=318 ms 64 bytes from 104.26.9.221 (104.26.9.221): icmp_seq=3 ttl=53 time=314 ms 64 bytes from 104.26.9.221 (104.26.9.221): icmp_seq=4 ttl=53 time=333 ms 64 bytes from 104.26.9.221 (104.26.9.221): icmp_seq=5 ttl=53 time=334 ms --- sixfab.com ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 7ms rtt min/avg/max/mdev = 314.010/323.157/333.655/8.553 ms


Enjoy your internet connection

Managing the Auto-connect/Reconnect service

To check if the service is active you can type.

sudo systemctl status reconnect.service
[email protected]:~ $ sudo systemctl status reconnect.service reconnect.service - PPP Auto Connection Loaded: loaded (/etc/systemd/system/reconnect.service; enabled; vendor preset: enabled) Active: active (running) since Tue 2020-11-24 18:52:23 GMT; 1min 46s ago Main PID: 502 (sh) Tasks: 3 (limit: 2065) CGroup: /system.slice/reconnect.service ├─502 /bin/sh /usr/src/reconnect.sh ├─585 /usr/sbin/pppd call provider └─799 sleep 10 Nov 24 18:52:26 raspberrypi pppd[525]: secondary DNS address 8.8.4.4 Nov 24 18:52:26 raspberrypi sudo[511]: pam_unix(sudo:session): session closed for user root Nov 24 18:52:26 raspberrypi pppd[585]: Script /etc/ppp/ip-up started (pid 586) Nov 24 18:52:27 raspberrypi sudo[639]: root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/sbin/route del default Nov 24 18:52:27 raspberrypi sudo[639]: pam_unix(sudo:session): session opened for user root by (uid=0) Nov 24 18:52:27 raspberrypi sudo[639]: pam_unix(sudo:session): session closed for user root Nov 24 18:52:27 raspberrypi sudo[648]: root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/sbin/route add default ppp0 Nov 24 18:52:27 raspberrypi sudo[648]: pam_unix(sudo:session): session opened for user root by (uid=0) Nov 24 18:52:27 raspberrypi sudo[648]: pam_unix(sudo:session): session closed for user root Nov 24 18:52:27 raspberrypi pppd[585]: Script /etc/ppp/ip-up finished (pid 586), status = 0x0

To stop your reconnect service, type:

sudo systemctl stop reconnect.service

To start the reconnect service when it is stopped, type:

sudo systemctl start reconnect.service

By default, the reconnect service is configured to start automatically when the server boots. If this is not what you want, you can disable this behavior by typing:

sudo systemctl disable reconnect.service

To re-enable the service to start up at boot, you can type:

sudo systemctl enable reconnect.service

Uninstall

If you are using auto-connect/reconnect service, stop the service and disable it.

sudo systemctl stop reconnect.service
sudo systemctl disable reconnect.service

Then delete the files.

sudo rm /etc/ppp/peers/provider
sudo rm /etc/chatscripts/chat-connect
sudo rm /etc/chatscripts/chat-disconnect

Credential

If your carrier asks for username and password;
Remove noauth from /etc/ppp/peers/provider and add following lines.

user “YOUR USERNAME”

password “YOURPASSWORD"

Changing the Configuration

You can change APN and PORT from /etc/ppp/peers/provider.

Table 1. Selecting Port

Shield/HATPORT
Base Shield / Base HATttyS0/ttyUSBx
Cellular IoT Application Shield / Cellular IoT HATttyS0/ttyUSBx
Tracker HATttyS0

Note: To use the UART(ttyS0) follow the steps mentioned in the UART guide.

To understand PPP further you can check PPP documentation.

If you have the Thales mini PCIe products we recommend using their pppd tutorial.

It is worth reading through the section on troubleshooting as this covers the more common issues with establishing and maintaining a network connection.