# RPi connection to internet via 4/5G connection

**URL:** <https://forum.core-electronics.com.au/t/rpi-connection-to-internet-via-4-5g-connection/19830>\
**Category:** Product Questions\
**Created:** [1 May 2024 04:37 UTC](https://forum.core-electronics.com.au/t/rpi-connection-to-internet-via-4-5g-connection/19830 "2024-05-01T04:37:12Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kym252504](https://avatars.discourse-cdn.com/v4/letter/k/9e8a1a/32.png) [@Kym252504](https://forum.core-electronics.com.au/u/Kym252504)\
**Post date:** [1 May 2024 04:37 UTC](https://forum.core-electronics.com.au/t/rpi-connection-to-internet-via-4-5g-connection/19830/1 "2024-05-01T04:37:12Z")

</div>

Hi Team.

I have a project that I have been working on for way too long!

The latest headache presented is connecting a Raspberry Pi to the internet via 4/5G network.

I purchased a TOPHAT for a Pi in which I can place a SIM card (I purchased a DATA only card).

I have followed many tutorials, youtubes, wiki instructions all of which have something extra to add to the puzzle, none of which have worked!

What HAT would people reccommend for this application? It doesnt really need GPS but that would be a bonus although is seems that GPS functionality and anything else can not happen concurrently so it kind of make this redundant.

The one I have (not mentioning brand or model for a reason so that I get a broader response) seems dodgy as even the GPS functionality is very much a hit and miss affair (with a PC. Non existant results using a Pi - I have tried several Pi’s si I can rule out a faulty Pi).

This whole affair once develpoed will need to stand isolated from any wired services, hence the need for 4/5G connection.

A penny for anyones thoughts!

---

<div class="post-metadata">

**Author:** ![Kym252504](https://avatars.discourse-cdn.com/v4/letter/k/9e8a1a/32.png) [@Kym252504](https://forum.core-electronics.com.au/u/Kym252504)\
**Post date:** [2 May 2024 02:17 UTC](https://forum.core-electronics.com.au/t/rpi-connection-to-internet-via-4-5g-connection/19830/2 "2024-05-02T02:17:07Z")

</div>

Update…

Using [Get Started with Super SIM, the Raspberry Pi 4 and the Waveshare 4G Hat | Twilio](https://www.twilio.com/docs/iot/supersim/getting-started-super-sim-raspberry-pi-waveshare-4g-hat) as a guide I have been able to get this far… and needing to have the HAT disconnected from the RPi so that I can get ttyUSB2 listed in … “ls /dev/tty\*”… A modem hangup.

XXXXXXXXXXXXXXX:~ $ sudo pon  
abort on (BUSY)  
abort on (VOICE)  
abort on (NO CARRIER)  
abort on (NO DIALTONE)  
abort on (NO DIAL TONE)  
abort on (NO ANSWER)  
abort on (DELAYED)  
abort on (ERROR)  
abort on (+CGATT: 0)  
send (AT^M)  
timeout set to 12 seconds  
expect (OK)  
AT^M^M  
OK  
– got it

send (ATH^M)  
expect (OK)  
^M  
ATH^M^M  
OK  
– got it

send (ATE1^M)  
expect (OK)  
^M  
ATE1^M^M  
OK  
– got it

send (AT+CGDCONT=1,“IP”,“super”,“”,0,0^M)  
expect (OK)  
^M  
AT+CGDCONT=1,“IP”,“super”,“”,0,0^M^M  
OK  
– got it

send (ATD_99#^M)  
timeout set to 22 seconds  
expect (CONNECT)  
^M  
ATD_99#^M^M  
CONNECT  
– got it

send (^M)  
Script /usr/sbin/chat -s -v -f /etc/chatscripts/gprs -T super finished (pid 4541), status = 0x0  
Serial connection established.  
using channel 53  
Using interface ppp0  
Connect: ppp0 ↔ /dev/ttyUSB2  
sent [LCP ConfReq id=0x1 \<asyncmap 0x0\> \<magic 0xef7e9554\>]  
rcvd [LCP ConfReq id=0xce \<asyncmap 0x0\> \<magic 0x7733871f\>]  
sent [LCP ConfNak id=0xce]  
rcvd [LCP ConfAck id=0x1 \<asyncmap 0x0\> \<magic 0xef7e9554\>]  
rcvd [LCP ConfReq id=0xcf \<asyncmap 0x0\> \<magic 0x7733871f\>]  
sent [LCP ConfAck id=0xcf \<asyncmap 0x0\> \<magic 0x7733871f\>]  
sent [LCP EchoReq id=0x0 magic=0xef7e9554]  
sent [PAP AuthReq id=0x1 user=“myusername@realm” password=]  
rcvd [LCP DiscReq id=0xd0 magic=0x7733871f]  
rcvd [LCP EchoRep id=0x0 magic=0x7733871f ef 7e 95 54]  
rcvd [PAP AuthAck id=0x1 “”]  
PAP authentication succeeded  
sent [CCP ConfReq id=0x1 \<deflate 15\> \<deflate(old#) 15\> \<bsd v1 15\>]  
sent [IPCP ConfReq id=0x1 \<compress VJ 0f 01\> \<addr 0.0.0.0\> \<ms-dns1 0.0.0.0\> \<ms-dns2 0.0.0.0\>]  
sent [IPV6CP ConfReq id=0x1]  
rcvd [LCP ProtRej id=0xd1 80 fd 01 01 00 0f 1a 04 78 00 18 04 78 00 15 03 2f]  
Protocol-Reject for ‘Compression Control Protocol’ (0x80fd) received  
rcvd [IPCP ConfNak id=0x1 \<ms-dns1 10.11.12.13\> \<ms-dns2 10.11.12.14\> \<ms-wins 10.11.12.13\> \<ms-wins 10.11.12.14\>]  
sent [IPCP ConfReq id=0x2 \<compress VJ 0f 01\> \<addr 0.0.0.0\> \<ms-dns1 10.11.12.13\> \<ms-dns2 10.11.12.14\> \<ms-wins 10.11.12.13\> \<ms-wins 10.11.12.14\>]  
Modem hangup  
Connection terminated.  
Any ideas?

---

<div class="post-metadata">

**Author:** ![Michael](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/michael/32/3545_2.png) [@Michael](https://forum.core-electronics.com.au/u/Michael)\
**Post date:** [2 May 2024 07:35 UTC](https://forum.core-electronics.com.au/t/rpi-connection-to-internet-via-4-5g-connection/19830/3 "2024-05-02T07:35:22Z")

</div>

Hi @Kym252504

I’ve trawled the waveshare [FAQ Page](https://www.waveshare.com/wiki/Template:SIM7600X_4G_HAT_FAQ) for this device but haven’t uncovered anything gratifying.

It looks like this is where things are coming undone.

`Protocol-Reject for ‘Compression Control Protocol’ (0x80fd) received`

Which led me to this [stack overflow](https://superuser.com/questions/778191/ppp-hangs-up-after-authentication) thread where a user suggests the carrier is rejecting the connection, and disabling compression.

Do you have documentation that covers the following commands that preceded the Protocol-Reject message?  
For clarity, they are:

```auto
sent [CCP ConfReq id=0x1 <deflate 15> <deflate(old#) 15> <bsd v1 15>]
sent [IPCP ConfReq id=0x1 <compress VJ 0f 01> <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]
sent [IPV6CP ConfReq id=0x1]
Protocol-Reject for ‘Compression Control Protocol’ (0x80fd) received

```

---

<div class="post-metadata">

**Author:** ![Kym252504](https://avatars.discourse-cdn.com/v4/letter/k/9e8a1a/32.png) [@Kym252504](https://forum.core-electronics.com.au/u/Kym252504)\
**Post date:** [2 May 2024 08:48 UTC](https://forum.core-electronics.com.au/t/rpi-connection-to-internet-via-4-5g-connection/19830/4 "2024-05-02T08:48:25Z")

</div>

> [@Kym252504](#):
>
> compress VJ 0f 01

Hi Michael.

Thank you for your response.

I too saw this and spent most of the afternoon trying to work out how to turn compression off… no luck, but with a bit of a break and asking the question a different way, i may have stumbled across something…

[https://forums.raspberrypi.com/viewtopic.php?t=351584](https://forums.raspberrypi.com/viewtopic.php?t=351584)  
“I’d start by disabling compression in pppd, e.g. ‘bsdcomp 0’, see the pppd man page entry for details. Sadly there are a large number of variables in a PPP connection like this, and it may take quite a bit of trial-and-error to get it working.”

One of the other issues is that i cant find half of the folders/files everyone refers to. ppp0 does not appear in ifconfig dump, basically Bootlace has shifted everything and has new folder names for everything. Most frustrating! When Im looking for something in a file I tend to COPY/PASTE into a word doc and then use search features…

I will see what transpires tomorrow.

Thanks again for your input into my problem…

Cheers.

---

<div class="post-metadata">

**Author:** ![Kym252504](https://avatars.discourse-cdn.com/v4/letter/k/9e8a1a/32.png) [@Kym252504](https://forum.core-electronics.com.au/u/Kym252504)\
**Post date:** [3 May 2024 01:07 UTC](https://forum.core-electronics.com.au/t/rpi-connection-to-internet-via-4-5g-connection/19830/5 "2024-05-03T01:07:24Z")

</div>

Okies…  
So I added  
bsdcom 0  
noccp  
to the bottom of /etc/ppp/options file and disabled anything that was associated with compression .

Now I get this… but no compression errors.

xxxxxxxxxxxx:~ $ sudo pon  
abort on (BUSY)  
abort on (VOICE)  
abort on (NO CARRIER)  
abort on (NO DIALTONE)  
abort on (NO DIAL TONE)  
abort on (NO ANSWER)  
abort on (DELAYED)  
abort on (ERROR)  
abort on (+CGATT: 0)  
send (AT^M)  
timeout set to 12 seconds  
expect (OK)  
AT^M^M  
OK  
– got it

send (ATH^M)  
expect (OK)  
^M  
ATH^M^M  
OK  
– got it

send (ATE1^M)  
expect (OK)  
^M  
ATE1^M^M  
OK  
– got it

send (AT+CGDCONT=1,“IP”,“super”,“”,0,0^M)  
expect (OK)  
^M  
AT+CGDCONT=1,“IP”,“super”,“”,0,0^M^M  
OK  
– got it

send (ATD_99#^M)  
timeout set to 22 seconds  
expect (CONNECT)  
^M  
ATD_99#^M^M  
CONNECT  
– got it

send (^M)  
Script /usr/sbin/chat -s -v -f /etc/chatscripts/gprs -T super finished (pid 2616), status = 0x0  
Serial connection established.  
using channel 2  
Using interface ppp0  
Connect: ppp0 ↔ /dev/ttyUSB2  
sent [LCP ConfReq id=0x1 \<asyncmap 0x0\> \<magic 0xd66a0c49\>]  
rcvd [LCP ConfReq id=0x4 \<asyncmap 0x0\> \<magic 0x7c1c49f5\>]  
sent [LCP ConfRej id=0x4]  
rcvd [LCP ConfAck id=0x1 \<asyncmap 0x0\> \<magic 0xd66a0c49\>]  
rcvd [LCP ConfReq id=0x5 \<asyncmap 0x0\> \<magic 0x7c1c49f5\>]  
sent [LCP ConfNak id=0x5]  
rcvd [LCP ConfReq id=0x6 \<asyncmap 0x0\> \<magic 0x7c1c49f5\>]  
sent [LCP ConfAck id=0x6 \<asyncmap 0x0\> \<magic 0x7c1c49f5\>]  
sent [LCP EchoReq id=0x0 magic=0xd66a0c49]  
sent [PAP AuthReq id=0x1 user=“myusername@realm” password=]  
rcvd [LCP DiscReq id=0x7 magic=0x7c1c49f5]  
rcvd [LCP EchoRep id=0x0 magic=0x7c1c49f5 d6 6a 0c 49]  
rcvd [PAP AuthAck id=0x1 “”]  
PAP authentication succeeded  
sent [IPCP ConfReq id=0x1 \<addr 0.0.0.0\> \<ms-dns1 0.0.0.0\> \<ms-dns2 0.0.0.0\>]  
sent [IPV6CP ConfReq id=0x1]  
rcvd [IPCP ConfNak id=0x1 \<ms-dns1 10.11.12.13\> \<ms-dns2 10.11.12.14\> \<ms-wins 10.11.12.13\> \<ms-wins 10.11.12.14\>]  
sent [IPCP ConfReq id=0x2 \<addr 0.0.0.0\> \<ms-dns1 10.11.12.13\> \<ms-dns2 10.11.12.14\> \<ms-wins 10.11.12.13\> \<ms-wins 10.11.12.14\>]  
Modem hangup  
Connection terminated.

![image](https://canada1.discourse-cdn.com/flex028/uploads/core_electronics/original/2X/3/38d77be22cb71f9b0bbc0fe5dd47750c26644d3b.png)  
This is all I get from a ifconfig…  
From what documentation i have found, there should be a ppp0 entry… No idea how to get one there…a re-install of ppp does nothing but report latest version already installed…

---

<div class="post-metadata">

**Author:** ![Michael](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/michael/32/3545_2.png) [@Michael](https://forum.core-electronics.com.au/u/Michael)\
**Post date:** [3 May 2024 07:05 UTC](https://forum.core-electronics.com.au/t/rpi-connection-to-internet-via-4-5g-connection/19830/6 "2024-05-03T07:05:23Z")

</div>

Step by step eh? Sounds like people find themselves on a similar journey with this kind of hardware…

From [this post](https://stackoverflow.com/questions/68983456/pppd-modem-hangup-after-pap-authentication-success) the replied suggests that:

> This looks like APN conflict. Check your PDP context → are you using default PDP context e.g. 1 or something else e.g. 3? I faced similar issues and it turned out that there were multiple APNs (default and non default) conflicting resulting in cell provider kicking out the connection (LCP terminated by peer).

THis other [troubleshooting resource](https://newjerseystyle.github.io/en/2020/Raspberry-Pi-connect-to-4G-LTE/#Troubleshooting) points to incorrect APN configuration as a reason for spurious hangups too.

> Modem hang up and you tried all solution, nothing work and do not know why
> 
> I have encountered few time on this problem, it hang up while connecting to network.  
> Because of incorrect APN, try all APN you can find on network and in your phone’s setting. To change the APN, edit /etc/ppp/peers/provider

---

<div class="post-metadata">

**Author:** ![Kym252504](https://avatars.discourse-cdn.com/v4/letter/k/9e8a1a/32.png) [@Kym252504](https://forum.core-electronics.com.au/u/Kym252504)\
**Post date:** [7 May 2024 01:07 UTC](https://forum.core-electronics.com.au/t/rpi-connection-to-internet-via-4-5g-connection/19830/7 "2024-05-07T01:07:08Z")

</div>

The full config file including all of the rubbish from testing.

This was the critical 2 lines, what was and what it needed to be. Hope this helps someone else.

```auto
#connect '/usr/sbin/chat -s -v -f /etc/chatscripts/gprs -T super'
connect '/usr/sbin/chat -s -v -f /etc/chatscripts/gprs -T telstra.internet'

```

Thank you Michael for all the assistance.

Cheers!

```auto
# example configuration for a dialup connection authenticated with PAP or CHAP
#
# This is the default configuration used by pon(1) and poff(1).
# See the manual page pppd(8) for information on all the options.

# MUST CHANGE: replace myusername@realm with the PPP login name given to
# your by your provider.
# There should be a matching entry with the password in /etc/ppp/pap-secrets
# and/or /etc/ppp/chap-secrets.
user "myusername@realm"

# MUST CHANGE: replace ******** with the phone number of your provider.
# The /etc/chatscripts/pap chat script may be modified to change the
# modem initialization string.
#connect "/usr/sbin/chat -v -f /etc/chatscripts/pap -T ********"

#connect '/usr/sbin/chat -s -v -f /etc/chatscripts/gprs -T super'
connect '/usr/sbin/chat -s -v -f /etc/chatscripts/gprs -T telstra.internet'
# Serial device to which the modem is connected.
#/dev/modem
/dev/ttyUSB2
#/dev/ttyAMA0

# Speed of the serial line.
115200
#9600

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

# Extral info from https://www.twilio.com/docs/iot/supersim/getting-started-sup>

#nocrtscts
#debug
#nodetach
#ipcp-accept-local
#ipcp-accept-remote

```

---

<div class="post-metadata">

**Author:** ![Michael](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/michael/32/3545_2.png) [@Michael](https://forum.core-electronics.com.au/u/Michael)\
**Post date:** [7 May 2024 01:36 UTC](https://forum.core-electronics.com.au/t/rpi-connection-to-internet-via-4-5g-connection/19830/8 "2024-05-07T01:36:58Z")

</div>

Thank you for coming back to close this loop @Kym252504  
As troubleshooting, comms, and especially wireless goes - It was always going to be something that feels kinda dumb 😕

I’m glad your project is on track 🥳

I’ll include your writeup in this other thread that shows how you arrived at this conclusion:

> [@Guide by Tim; 4G and GPS HAT For Raspberry Pi - Waveshare SIM7600X](https://forum.core-electronics.com.au/t/guide-by-tim-4g-and-gps-hat-for-raspberry-pi-waveshare-sim7600x/14357/135):
>
> Hi Samuel. Thanks for the info. I had been thinking about the possible APN issue… The instructions I followed here … [Get Started with Super SIM, the Raspberry Pi 4 and the Waveshare 4G Hat | Twilio](https://www.twilio.com/docs/iot/supersim/getting-started-super-sim-raspberry-pi-waveshare-4g-hat) Did not explain ( although now it is obvious) the the APN setting “super” needs to reflect the APN of the intended network. Unless you research AT+CGDCONT instruction, its not obvious about whats going on and unfortunately, not explained! I changed mine to AT+CGDCONT=1,“IP”,“telstra.internet” when…

* * *

_PS. I edited your post a bit to format the code with a code block so it should be a bit easier on the eyes._
