viveksanagari
Posts: 9
Joined: Tue Dec 18, 2018 4:11 pm

4G dongle connected (Raspberry Pi-2) but no internet

Mon Jan 14, 2019 6:53 pm

Hi,
I am Vivek, new to raspberry and USB dongle, and I am in need of some help from you guys.

I have a,
1. Raspberry Pi 2 with Raspbian stretch Lite. (Using camera module)
2. Huawei E3372 LTE USB stick.
3. Sim card with static IP from Telenor.

On Raspberry Pi 2 I am having RTMP stream at http://<Rpi-IP-address>/view/ on the pi. I want the raspberry pi to have a 4g connection to be able to access it through an IP address. Thus I am using Huawei LTE stick with Telenor sim card on the raspberry pi.
ifconfig shows the LTE stick as:

Code: Select all

[email protected]:/home/pi# ifconfig ppp0
ppp0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST>  mtu 1500
        inet 79.102.249.213  netmask 255.255.255.255  destination 0.0.0.0
        ppp  txqueuelen 3  (Point-to-Point Protocol)
        RX packets 16  bytes 906 (906.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 18  bytes 983 (983.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
I am having the IP address to the LTE stick as above and I am able to ping Internet from that IP address.

Code: Select all

[email protected]:/home/pi# ping -I ppp0 www.google.com
PING www.google.com (172.217.20.36) from 79.102.249.213 ppp0: 56(84) bytes of data.
64 bytes from arn11s01-in-f4.1e100.net (172.217.20.36): icmp_seq=1 ttl=54 time=128 ms
64 bytes from arn11s01-in-f4.1e100.net (172.217.20.36): icmp_seq=2 ttl=54 time=42.7 ms
64 bytes from arn11s01-in-f4.1e100.net (172.217.20.36): icmp_seq=3 ttl=54 time=40.7 ms
^C
--- www.google.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 40.708/70.566/128.214/40.772 ms
However, I am not able to ping this IP (79.102.249.213) from a laptop (Lenovo) which has an IP 192.168.1.X.

Code: Select all

[email protected]:~$ ping 79.102.249.213
PING 79.102.249.213 (79.102.249.213) 56(84) bytes of data.
^C
--- 79.102.249.213 ping statistics ---
5 packets transmitted, 0 received, 100% packet loss, time 4032ms
I am trying to access the rtmp stream from a laptop (Lenovo) with http://<Rpi-IP-address>/view/ on its browser. But I am not able to access it and neither could ssh to that IP nor ping. However, If I connect an ethernet cable to the Raspberry Pi I can do all these with the IP assigned to the ethernet interface, I am trying to achieve it using the LTE stick.

If a few additional information may help to solve it;
route command shows,

Code: Select all

[email protected]:/home/pi# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG    202    0        0 eth0
0.0.0.0         0.0.0.0         0.0.0.0         U     700    0        0 ppp0
192.168.1.0     0.0.0.0         255.255.255.0   U     202    0        0 eth0
ip route command shows,

Code: Select all

[email protected]:/home/pi# ip route
default via 192.168.1.1 dev eth0 src 192.168.1.100 metric 202 
default dev ppp0 proto static scope link metric 700 
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.100 metric 202 
eth0 is the ethernet interface and ppp0 is the LTE stick interface.

Please help.. Thank you very much in advance..

User avatar
topguy
Posts: 5570
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: 4G dongle connected (Raspberry Pi-2) but no internet

Tue Jan 15, 2019 9:35 am

One thing you should do first..
- CHANGE THE DEFAULT PASSWORD ON USER "pi" !!!
If my tips will lead you to success and there is no firewall on Telenor side that blocks incoming traffic to your IP, you will be hacked if you dont secure or disable SSH.

I think your main problem is that eth0 gateway is still default gateway. The Pi will send responses to incoming traffic out via eth0.
If you remove the default gateway from eth0 ( or change the metric maybe ) you should be able to ping 8.8.8.8 without specifying interface.

What script/setup method are you using to set up ppp0 ?

drgeoff
Posts: 9385
Joined: Wed Jan 25, 2012 6:39 pm

Re: 4G dongle connected (Raspberry Pi-2) but no internet

Tue Jan 15, 2019 10:39 am

Many mobile network providers block incoming access.

User avatar
r3d4
Posts: 967
Joined: Sat Jul 30, 2011 8:21 am
Location: ./

Re: 4G dongle connected (Raspberry Pi-2) but no internet

Tue Jan 15, 2019 10:51 am

drgeoff wrote:
Tue Jan 15, 2019 10:39 am
Many mobile network providers block incoming access.
see also
klricks wrote:
Sat Dec 10, 2016 5:58 am
Many if not most broadband 3G/4G providers use a Carrier Grade NAT setup: https://en.wikipedia.org/wiki/Carrier-grade_NAT
This means you get a local IP from behind the providers router(s). 192.168.x.x or 10.x.x.x
If this is the case then it will be impossible to port forward or host any kind of server such SSH VNC or web host etc.
The only option would be to use a service such as Weaved.

Some carriers do offer a static public IP on business accounts.
viewtopic.php?t=167879#p1079955 - Re: How to remote access Pi connected to 4G hotspot

viewtopic.php?f=63&t=227462#4G Modem on RPI in rural area

viveksanagari
Posts: 9
Joined: Tue Dec 18, 2018 4:11 pm

Re: 4G dongle connected (Raspberry Pi-2) but no internet

Tue Jan 15, 2019 11:01 am

Hi,
Thank you very much for replying.

@topguy. Now I have changed the default password on the pi.

One thing here is, as I have the Raspbian stretch Lite version running on my pi I do not have access to the desktop version of the pi. Thus to access and control pi I had to connect the pi through Ethernet cable to computer/router to be able to ssh into pi.
Now that I am having both Ethernet and the LTE stick connected to the pi at the same time. Thus I am SSHing into the pi using ssh [email protected]<EthernetInterface-IP> command from my laptop and trying to do all the stuff.

Here I tried to remove the default from eth0 even then I couldn't ping to 8.8.8.8. As seen below both gateway and genmask are 0.0.0.0, is that normal for an LTE stick(ppp0)? or is that the problem for not being able to access the internet?

Code: Select all

[email protected]:/home/pi# ip route del default dev eth0
[email protected]:/home/pi# ip route
default dev ppp0 proto static scope link metric 700 
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.100 metric 202 
[email protected]:/home/pi# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         0.0.0.0         0.0.0.0         U     700    0        0 ppp0
192.168.1.0     0.0.0.0         255.255.255.0   U     202    0        0 eth0
[email protected]:/home/pi# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
^C
--- 8.8.8.8 ping statistics ---
7 packets transmitted, 0 received, 100% packet loss, time 6233ms
What script/setup method are you using to set up ppp0 ?
I used nmcli command line tool to set up the apn for the LTE stick. After setting the apn to static.telenor.se I have got the IP for the ppp0 (LTE interface) and even the nmcli tool shows it as gsm connection and the state as connected as below.

Code: Select all

[email protected]:/home/pi# nmcli dev status
DEVICE   TYPE      STATE      CONNECTION         
eth0     ethernet  connected  Wired connection 1 
ttyUSB0  gsm       connected  gsm-2              
lo       loopback  unmanaged  --                 
Last edited by viveksanagari on Tue Jan 15, 2019 11:05 am, edited 1 time in total.

viveksanagari
Posts: 9
Joined: Tue Dec 18, 2018 4:11 pm

Re: 4G dongle connected (Raspberry Pi-2) but no internet

Tue Jan 15, 2019 11:04 am

Hi,
drgeoff wrote:
Tue Jan 15, 2019 10:39 am
Many mobile network providers block incoming access.
How can I enable its access to internet?

viveksanagari
Posts: 9
Joined: Tue Dec 18, 2018 4:11 pm

Re: 4G dongle connected (Raspberry Pi-2) but no internet

Tue Jan 15, 2019 11:10 am

drgeoff wrote:
Tue Jan 15, 2019 10:39 am
Many mobile network providers block incoming access.
I have tested the Telenor sim card in my phone and I was able to access the mobile network from it. using the same sim card in the Huawei LTE USB dongle would be a different case/method?

drgeoff
Posts: 9385
Joined: Wed Jan 25, 2012 6:39 pm

Re: 4G dongle connected (Raspberry Pi-2) but no internet

Tue Jan 15, 2019 11:40 am

viveksanagari wrote:
Tue Jan 15, 2019 11:10 am
drgeoff wrote:
Tue Jan 15, 2019 10:39 am
Many mobile network providers block incoming access.
I have tested the Telenor sim card in my phone and I was able to access the mobile network from it. using the same sim card in the Huawei LTE USB dongle would be a different case/method?
Initiating a connection from the mobile to the internet is not the same as initiating from the internet to the mobile.

viveksanagari
Posts: 9
Joined: Tue Dec 18, 2018 4:11 pm

Re: 4G dongle connected (Raspberry Pi-2) but no internet

Tue Jan 15, 2019 12:44 pm

r3d4 wrote:
Tue Jan 15, 2019 10:51 am
klricks wrote:
Sat Dec 10, 2016 5:58 am
Many if not most broadband 3G/4G providers use a Carrier Grade NAT setup: https://en.wikipedia.org/wiki/Carrier-grade_NAT
This means you get a local IP from behind the providers router(s). 192.168.x.x or 10.x.x.x
If this is the case then it will be impossible to port forward or host any kind of server such SSH VNC or web host etc.
The only option would be to use a service such as Weaved.

Some carriers do offer a static public IP on business accounts.
I got this Telenor sim card ordered from a colleague. I have tried setting the APN to services.telenor.se, internet.telenor.se for no use, but later my colleague said the sim card he bought was a static IP from Telenor. Then I have set it to static.telenor.se APN and I received IP to LTE stick like 79.102.249.213 or 178.28.118.11 which look like public IPs.
But the route -n command in terminal shows:

Code: Select all

[email protected]:/home/pi# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         0.0.0.0         0.0.0.0         U     700    0        0 ppp0
192.168.1.0     0.0.0.0         255.255.255.0   U     202    0        0 eth0
However, I dont have Destination, Gateway, Genmask for the ppp0 (LTE) interface. how may I solve this problem?

viveksanagari
Posts: 9
Joined: Tue Dec 18, 2018 4:11 pm

Re: 4G dongle connected (Raspberry Pi-2) but no internet

Tue Jan 15, 2019 12:45 pm

drgeoff wrote:
Tue Jan 15, 2019 11:40 am
viveksanagari wrote:
Tue Jan 15, 2019 11:10 am
drgeoff wrote:
Tue Jan 15, 2019 10:39 am
Many mobile network providers block incoming access.
I have tested the Telenor sim card in my phone and I was able to access the mobile network from it. using the same sim card in the Huawei LTE USB dongle would be a different case/method?
Initiating a connection from the mobile to the internet is not the same as initiating from the internet to the mobile.
So here the connection from the LTE dongle can be seen as, initiating from the internet to the mobile?

User avatar
topguy
Posts: 5570
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: 4G dongle connected (Raspberry Pi-2) but no internet

Tue Jan 15, 2019 3:07 pm

Can you show us the nmcli commands you do use to setyp/modify ppp0 ?
Did you get information of a gateway address from Telenor together with the static address ?

Maybe relevant discussion: https://unix.stackexchange.com/question ... with-nmcli

viveksanagari
Posts: 9
Joined: Tue Dec 18, 2018 4:11 pm

Re: 4G dongle connected (Raspberry Pi-2) but no internet

Tue Jan 15, 2019 3:45 pm

topguy wrote:
Tue Jan 15, 2019 3:07 pm
Can you show us the nmcli commands you do use to setyp/modify ppp0 ?
Yes. I initially referred to https://unix.stackexchange.com/question ... sing-nmcli link while I was first setting up ppp0. Which looks somewhat similar to the link you have suggested.
To see the connection type I use:

Code: Select all

[email protected]:/home/pi# nmcli dev status
DEVICE   TYPE      STATE      CONNECTION         
eth0     ethernet  connected  Wired connection 1 
ttyUSB0  gsm       connected  gsm-2              
lo       loopback  unmanaged  --                 
[email protected]:/home/pi# nmcli connection
NAME                UUID                                  TYPE            DEVICE  
Wired connection 1  18b46e02-36e8-3136-9675-0ef84bd8f572  802-3-ethernet  eth0    
gsm-2               2a34e58e-6f2b-4af7-937a-fa9c7cbf08ed  gsm             ttyUSB0 
The commands I used for setting the APN are:

Code: Select all

[email protected]:/home/pi# nmcli connection edit id gsm-2

===| nmcli interactive connection editor |===

Editing existing 'gsm' connection: 'gsm-2'

Type 'help' or '?' for available commands.
Type 'describe [<setting>.<prop>]' for detailed property description.

You may edit the following settings: connection, gsm, serial, ppp, ipv4, ipv6, proxy
nmcli> print
===============================================================================
                      Connection profile details (gsm-2)
===============================================================================
connection.id:                          gsm-2
connection.uuid:                        2a34e58e-6f2b-4af7-937a-fa9c7cbf08ed
connection.stable-id:                   --
connection.interface-name:              --
connection.type:                        gsm
connection.autoconnect:                 yes
connection.autoconnect-priority:        0
connection.autoconnect-retries:         -1 (default)
connection.timestamp:                   1547566175
connection.read-only:                   no
connection.permissions:                 
connection.zone:                        --
connection.master:                      --
connection.slave-type:                  --
connection.autoconnect-slaves:          -1 (default)
connection.secondaries:                 
connection.gateway-ping-timeout:        0
connection.metered:                     unknown
connection.lldp:                        -1 (default)
-------------------------------------------------------------------------------
ipv4.method:                            auto
ipv4.dns:                               
ipv4.dns-search:                        
ipv4.dns-options:                       (default)
ipv4.dns-priority:                      0
ipv4.addresses:                         
ipv4.gateway:                           --
ipv4.routes:                            
ipv4.route-metric:                      -1
ipv4.ignore-auto-routes:                no
ipv4.ignore-auto-dns:                   no
ipv4.dhcp-client-id:                    --
ipv4.dhcp-timeout:                      0
ipv4.dhcp-send-hostname:                yes
ipv4.dhcp-hostname:                     --
ipv4.dhcp-fqdn:                         --
ipv4.never-default:                     no
ipv4.may-fail:                          yes
ipv4.dad-timeout:                       -1 (default)
-------------------------------------------------------------------------------
ipv6.method:                            auto
ipv6.dns:                               
ipv6.dns-search:                        
ipv6.dns-options:                       (default)
ipv6.dns-priority:                      0
ipv6.addresses:                         
ipv6.gateway:                           --
ipv6.routes:                            
ipv6.route-metric:                      -1
ipv6.ignore-auto-routes:                no
ipv6.ignore-auto-dns:                   no
ipv6.never-default:                     no
ipv6.may-fail:                          yes
ipv6.ip6-privacy:                       -1 (unknown)
ipv6.addr-gen-mode:                     stable-privacy
ipv6.dhcp-send-hostname:                yes
ipv6.dhcp-hostname:                     --
ipv6.token:                             --
-------------------------------------------------------------------------------
gsm.number:                             *99#
gsm.username:                           --
gsm.password:                           <hidden>
gsm.password-flags:                     0 (none)
gsm.apn:                                static.telenor.se
gsm.network-id:                         --
gsm.pin:                                <hidden>
gsm.pin-flags:                          0 (none)
gsm.home-only:                          no
gsm.device-id:                          --
gsm.sim-id:                             --
gsm.sim-operator-id:                    --
-------------------------------------------------------------------------------
proxy.method:                           none
proxy.browser-only:                     no
proxy.pac-url:                          --
proxy.pac-script:                       --
-------------------------------------------------------------------------------
nmcli> set gsm.apn static.telenor.se
nmcli> save
Connection 'gsm-2' (2a34e58e-6f2b-4af7-937a-fa9c7cbf08ed) successfully updated.
nmcli> quit
[email protected]:/home/pi# 
Did you get information of a gateway address from Telenor together with the static address?
No, I didn't know, do we usually get it?

viveksanagari
Posts: 9
Joined: Tue Dec 18, 2018 4:11 pm

Re: 4G dongle connected (Raspberry Pi-2) but no internet

Thu Jan 17, 2019 3:54 pm

viveksanagari wrote:
Tue Jan 15, 2019 3:45 pm
topguy wrote:
Tue Jan 15, 2019 3:07 pm
Can you show us the nmcli commands you do use to setyp/modify ppp0 ?
The commands I used for setting the APN are:

Code: Select all

[email protected]:/home/pi# nmcli connection edit id gsm-2

===| nmcli interactive connection editor |===

Editing existing 'gsm' connection: 'gsm-2'

Type 'help' or '?' for available commands.
Type 'describe [<setting>.<prop>]' for detailed property description.

You may edit the following settings: connection, gsm, serial, ppp, ipv4, ipv6, proxy
nmcli> print
===============================================================================
                      Connection profile details (gsm-2)
===============================================================================
connection.id:                          gsm-2
connection.uuid:                        2a34e58e-6f2b-4af7-937a-fa9c7cbf08ed
connection.stable-id:                   --
connection.interface-name:              --
connection.type:                        gsm
connection.autoconnect:                 yes
connection.autoconnect-priority:        0
connection.autoconnect-retries:         -1 (default)
connection.timestamp:                   1547566175
connection.read-only:                   no
connection.permissions:                 
connection.zone:                        --
connection.master:                      --
connection.slave-type:                  --
connection.autoconnect-slaves:          -1 (default)
connection.secondaries:                 
connection.gateway-ping-timeout:        0
connection.metered:                     unknown
connection.lldp:                        -1 (default)
-------------------------------------------------------------------------------
ipv4.method:                            auto
ipv4.dns:                               
ipv4.dns-search:                        
ipv4.dns-options:                       (default)
ipv4.dns-priority:                      0
ipv4.addresses:                         
ipv4.gateway:                           --
ipv4.routes:                            
ipv4.route-metric:                      -1
ipv4.ignore-auto-routes:                no
ipv4.ignore-auto-dns:                   no
ipv4.dhcp-client-id:                    --
ipv4.dhcp-timeout:                      0
ipv4.dhcp-send-hostname:                yes
ipv4.dhcp-hostname:                     --
ipv4.dhcp-fqdn:                         --
ipv4.never-default:                     no
ipv4.may-fail:                          yes
ipv4.dad-timeout:                       -1 (default)
-------------------------------------------------------------------------------
ipv6.method:                            auto
ipv6.dns:                               
ipv6.dns-search:                        
ipv6.dns-options:                       (default)
ipv6.dns-priority:                      0
ipv6.addresses:                         
ipv6.gateway:                           --
ipv6.routes:                            
ipv6.route-metric:                      -1
ipv6.ignore-auto-routes:                no
ipv6.ignore-auto-dns:                   no
ipv6.never-default:                     no
ipv6.may-fail:                          yes
ipv6.ip6-privacy:                       -1 (unknown)
ipv6.addr-gen-mode:                     stable-privacy
ipv6.dhcp-send-hostname:                yes
ipv6.dhcp-hostname:                     --
ipv6.token:                             --
-------------------------------------------------------------------------------
gsm.number:                             *99#
gsm.username:                           --
gsm.password:                           <hidden>
gsm.password-flags:                     0 (none)
gsm.apn:                                static.telenor.se
gsm.network-id:                         --
gsm.pin:                                <hidden>
gsm.pin-flags:                          0 (none)
gsm.home-only:                          no
gsm.device-id:                          --
gsm.sim-id:                             --
gsm.sim-operator-id:                    --
-------------------------------------------------------------------------------
proxy.method:                           none
proxy.browser-only:                     no
proxy.pac-url:                          --
proxy.pac-script:                       --
-------------------------------------------------------------------------------
nmcli> set gsm.apn static.telenor.se
nmcli> save
Connection 'gsm-2' (2a34e58e-6f2b-4af7-937a-fa9c7cbf08ed) successfully updated.
nmcli> quit
[email protected]:/home/pi# 
Do I need to add any settings other than APN name (static.telenor.se) to access the internet from an LTE dongle?

Return to “General discussion”