3

Huawei E369 3G modem connected to RPi3 Model A+ and managed by NetworkManager cli:

  • connects
  • allows for pinging websites
  • has working DNS

But does not allow for performing any http requests using CURL so:

ping -I ppp0 www.google.com works but

curl --interface ppp0 www.google.com does not.

The closest to my issue I found is this thread on Raspberry Pi forums but it is inconclusive to me what changed fixed it.

I've plugged modem on Mint and it works so I've compared outputs from nmcli device show side by side and found differences (MTU set to 0 and no routes on RPI):

Raspberry

GENERAL.DEVICE:                         ttyUSB1
GENERAL.TYPE:                           gsm
GENERAL.HWADDR:                         (unknown)
GENERAL.MTU:                            0
GENERAL.STATE:                          100 (connected)
GENERAL.CONNECTION:                     plus
GENERAL.CON-PATH:                       /org/freedesktop/NetworkManager/ActiveConnection/1
IP4.ADDRESS[1]:                         31.2.90.38/32
IP4.GATEWAY:                            31.2.90.38
IP4.DNS[1]:                             212.2.127.254
IP4.DNS[2]:                             212.2.96.54

Mint Desktop

GENERAL.DEVICE:                         ttyUSB1
GENERAL.TYPE:                           gsm
GENERAL.HWADDR:                         (unknown)
GENERAL.MTU:                            1500
GENERAL.STATE:                          100 (connected)
GENERAL.CONNECTION:                     Plus Standard access 1
GENERAL.CON-PATH:                       /org/freedesktop/NetworkManager/ActiveConnection/8
IP4.ADDRESS[1]:                         46.169.152.5/32
IP4.GATEWAY:                            46.169.152.5
IP4.ROUTE[1]:                           dst = 46.169.152.5/32, nh = 0.0.0.0, mt = 700
IP4.ROUTE[2]:                           dst = 0.0.0.0/0, nh = 46.169.152.5, mt = 700
IP4.DNS[1]:                             212.2.127.254
IP4.DNS[2]:                             212.2.96.52

For completeness I attach output from 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    302    0        0 wlan0
0.0.0.0         31.2.90.38      0.0.0.0         UG    700    0        0 ppp0
31.2.90.38      0.0.0.0         255.255.255.255 UH    700    0        0 ppp0
192.168.1.0     0.0.0.0         255.255.255.0   U     302    0        0 wlan0

And mmcli -m 0:

/org/freedesktop/ModemManager1/Modem/0 (device id '1668e1f193c8f1f8cf30b97abb39eb278ed191d6')
  -------------------------
  Hardware |   manufacturer: 'Huawei Technologies Co., Ltd.'
           |          model: 'E369'
           |       revision: '41.102.18.00.264'
           |      supported: 'gsm-umts'
           |        current: 'gsm-umts'
           |   equipment id: '868414002630527'
  -------------------------
  System   |         device: '/sys/devices/platform/soc/3f980000.usb/usb1/1-1'
           |        drivers: 'option1'
           |         plugin: 'Huawei'
           |   primary port: 'ttyUSB1'
           |          ports: 'ttyUSB0 (at), ttyUSB1 (at)'
  -------------------------
  Numbers  |           own : 'unknown'
  -------------------------
  Status   |           lock: 'none'
           | unlock retries: 'sim-pin (3), sim-pin2 (3), sim-puk (10), sim-puk2 (10)'
           |          state: 'connected'
           |    power state: 'on'
           |    access tech: 'edge'
           | signal quality: '100' (recent)
  -------------------------
  Modes    |      supported: 'allowed: 2g; preferred: none
           |                  allowed: 3g; preferred: none
           |                  allowed: 2g, 3g; preferred: 2g
           |                  allowed: 2g, 3g; preferred: 3g
           |                  allowed: 2g, 3g; preferred: none'
           |        current: 'allowed: 2g, 3g; preferred: none'
  -------------------------
  Bands    |      supported: 'unknown'
           |        current: 'unknown'
  -------------------------
  IP       |      supported: 'ipv4'
  -------------------------
  3GPP     |           imei: '<imei>'
           |  enabled locks: 'none'
           |    operator id: '26001'
           |  operator name: '0050006C00750073'
           |   subscription: 'unknown'
           |   registration: 'home'
  -------------------------
  SIM      |           path: '/org/freedesktop/ModemManager1/SIM/0'

  -------------------------
  Bearers  |          paths: '/org/freedesktop/ModemManager1/Bearer/0'

and configuration in network manager system connections:

[connection]
id=Plus Standard access 1
uuid=b4c6111d-8735-46ed-9b51-60887a84ec7a
type=gsm
autoconnect=false
permissions=user:pi:;
interface=ttyUSB1

[gsm]
apn=www.plusgsm.pl
home-only=true
number=*99#
password-flags=0
username=plusgsm

[gsm-secrets]
password=plusgsm

[ipv4]
dns-search=
method=auto

[ipv6]
addr-gen-mode=stable-privacy
dns-search=
ip6-privacy=0
method=auto
  • What OS? Why are you using Network Manager? – Milliways Mar 27 at 21:36
  • Raspbian Stretch Lite, I got stuck with connecting using wvdial and sakis3g managed to configure almost everything but got stuck during connection phase. So I decided to give network manager a try since it was able to establish connection on Mint Desktop. – xmichaelx Mar 27 at 21:38
  • 2
    Network Manager is not used by Raspbian - you are free to try (you haven't said what you did), but you are likely to get more help using one of the standard Raspbian tools. It appears that you still have other networking running. – Milliways Mar 28 at 4:41
  • 1
    Looks like you have two default routes (Destination 0.0.0.0). The system can only use one of the default routes, so delete the default route for wlan0 so that all non-local traffic is sent to ppp0. I think your ping command worked because "-I ppp0" tells ping which interface to use without going through the routing table. – Chad Farmer Mar 28 at 20:47
  • 1
    Go ahead and answer it. I wasn't near a RPi to do the work for a real answer. You can show command output, etc. Glad to help. – Chad Farmer Mar 29 at 23:25
1

As Chad Farmer mentioned the issue was with having two default routes (Destination 0.0.0.0). So assuming that you have the same issue and route -n output that looks like this:

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    302    0        0 wlan0
0.0.0.0         31.2.90.38      0.0.0.0         UG    700    0        0 ppp0
31.2.90.38      0.0.0.0         255.255.255.255 UH    700    0        0 ppp0
192.168.1.0     0.0.0.0         255.255.255.0   U     302    0        0 wlan0

Then in order to fix the issue you need to run:

sudo ip route del default via 192.168.1.1 (ip addres of default gateway on wlan0 interface)

After this route -n output:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         31.2.90.38      0.0.0.0         UG    700    0        0 ppp0
31.2.90.38      0.0.0.0         255.255.255.255 UH    700    0        0 ppp0
192.168.1.0     0.0.0.0         255.255.255.0   U     302    0        0 wlan0

and curl --interface ppp0 www.google.com finally starts to work as do other http requests.

Important note is that outgoing traffic will now go through mobile connection so be careful with apt-get.

  • 1
    It is possible to create multiple routing tables in Linux so that you can have a different default route in each table. You create routing rules for selecting which table to use. How to do that is off-topic for this question and somewhat complicated. Search for iproute2 if you need more than one default route (multiple different gateway routers). – Chad Farmer Mar 29 at 23:30
  • Thanks, I only periodically open mobile connection to send telemetry so multiple routing tables sounds like perfect solution for me. – xmichaelx Mar 30 at 8:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.