0

I have a Raspberry Pi running the latest Raspberry Pi OS with Linux Kernel 6.6.

I have a Quectel EC25 modem with an active SIM card that successfully connects to the internet. I can ping 8.8.8.8 through this wwan0 interface, but not google.com. I have tried setting the nameserver entries in resolv.conf, however DNS seems to keep failing. I have disabled NetworkManager and systemd-resolved services so that they do not interface ( they did not improve the DNS situation when running ). I have tried nslookup and dig with the wwan0 interface inside a network namespace and they immediately succeed. I don't understand how dig/nslookup work, but not ping. How can I get DNS to work through the cellular modem?

Network namespace setup script:

root@raspberrypi:/home/pi/Desktop# cat create_and_enter_ns.sh
#!/bin/bash

MODEM_IF="wwan0"

ip netns add cellular
ip link set $MODEM_IF netns cellular
ip netns exec cellular bash

Connection script ran from inside the network namespace:

root@raspberrypi:/home/pi/Desktop# cat connect-cellular.sh
#!/bin/bash

MODEM_IF="wwan0"

echo "-------------------------------------------------------"
echo "*** Setting up cellular modem ..."

ip link set $MODEM_IF down
echo 'Y' | sudo tee /sys/class/net/wwan0/qmi/raw_ip
ip link set $MODEM_IF up
qmicli -p -d /dev/cdc-wdm0 --device-open-net='net-raw-ip|net-no-qos-header' --wds-start-network="apn='super',ip-type=4" --client-no-release-cid

echo "-------------------------------------------------------"
echo "*** Requesting IP Address for modem ..."

udhcpc -q -f -i wwan0

echo "-------------------------------------------------------"
echo "*** Displaying cellular connection details ..."

qmicli -d /dev/cdc-wdm0 --wds-get-current-settings

echo "-------------------------------------------------------"
echo "*** Setting nameservers in resolv.conf ..."

echo "nameserver 8.8.8.8" > /etc/resolv.conf
echo "nameserver 8.8.4.4" > /etc/resolv.conf

echo "-------------------------------------------------------"
echo "*** Displaying routes ..."

ip route
route

echo "-------------------------------------------------------"
echo "*** DNS Lookups ..."

nslookup google.com
dig google.com

echo "-------------------------------------------------------"
echo "*** Attempting pings ..."

echo "*** Pinging 8.8.8.8 ..."
ping -c 3 -W 3 8.8.8.8

echo "*** Pinging google.com ..."
ping -c 3 -W 3 google.com

echo "-------------------------------------------------------"
echo "*** Done ..."

Connection script output:

root@raspberrypi:/home/pi/Desktop# ./connect-cellular.sh
-------------------------------------------------------
*** Setting up cellular modem ...
Y
[/dev/cdc-wdm0] Network started
        Packet data handle: '2269105392'
[/dev/cdc-wdm0] Client ID not released:
        Service: 'wds'
            CID: '18'
-------------------------------------------------------
*** Requesting IP Address for modem ...
udhcpc: started, v1.35.0
Dropped protocol specifier '.udhcpc' from 'wwan0.udhcpc'. Using 'wwan0' (ifindex=3).
Failed to revert interface configuration: Unit dbus-org.freedesktop.resolve1.service not found.
udhcpc: broadcasting discover
udhcpc: broadcasting select for 100.75.157.67, server 100.75.157.68
udhcpc: lease of 100.75.157.67 obtained from 100.75.157.68, lease time 7200
Dropped protocol specifier '.udhcpc' from 'wwan0.udhcpc'. Using 'wwan0' (ifindex=3).
Failed to set DNS configuration: Unit dbus-org.freedesktop.resolve1.service not found.
-------------------------------------------------------
*** Displaying cellular connection details ...
[/dev/cdc-wdm0] Current settings retrieved:
           IP Family: IPv4
        IPv4 address: 100.75.157.67
    IPv4 subnet mask: 255.255.255.248
IPv4 gateway address: 100.75.157.68
    IPv4 primary DNS: 8.8.4.4
  IPv4 secondary DNS: 8.8.8.8
                 MTU: 1360
             Domains: none
-------------------------------------------------------
*** Setting nameservers in resolv.conf ...
-------------------------------------------------------
*** Displaying routes ...
default via 100.75.157.68 dev wwan0
100.75.157.64/29 dev wwan0 proto kernel scope link src 100.75.157.67
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         100.75.157.68   0.0.0.0         UG    0      0        0 wwan0
100.75.157.64   0.0.0.0         255.255.255.248 U     0      0        0 wwan0
-------------------------------------------------------
*** DNS Lookups ...
Server:         8.8.4.4
Address:        8.8.4.4#53

Non-authoritative answer:
Name:   google.com
Address: 142.251.163.139
Name:   google.com
Address: 142.251.163.101
Name:   google.com
Address: 142.251.163.138
Name:   google.com
Address: 142.251.163.102
Name:   google.com
Address: 142.251.163.113
Name:   google.com
Address: 142.251.163.100
Name:   google.com
Address: 2607:f8b0:4004:c1b::8b
Name:   google.com
Address: 2607:f8b0:4004:c1b::8a
Name:   google.com
Address: 2607:f8b0:4004:c1b::64
Name:   google.com
Address: 2607:f8b0:4004:c1b::71


; <<>> DiG 9.18.24-1-Debian <<>> google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7473
;; flags: qr rd ra; QUERY: 1, ANSWER: 6, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;google.com.                    IN      A

;; ANSWER SECTION:
google.com.             15      IN      A       142.251.163.100
google.com.             15      IN      A       142.251.163.101
google.com.             15      IN      A       142.251.163.138
google.com.             15      IN      A       142.251.163.139
google.com.             15      IN      A       142.251.163.102
google.com.             15      IN      A       142.251.163.113

;; Query time: 132 msec
;; SERVER: 8.8.4.4#53(8.8.4.4) (UDP)
;; WHEN: Fri Apr 05 02:36:11 BST 2024
;; MSG SIZE  rcvd: 135

-------------------------------------------------------
*** Attempting pings ...
*** Pinging 8.8.8.8 ...
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=115 time=145 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=115 time=183 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=115 time=142 ms

--- 8.8.8.8 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 142.221/156.747/183.145/18.697 ms
*** Pinging google.com ...
PING google.com (142.251.163.139) 56(84) bytes of data.

--- google.com ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2056ms

-------------------------------------------------------
*** Done ...

Update:

In fact, it seems DNS is working fine to resolve various domain names, but I can never ping them through wwan0.

root@raspberrypi:/home/pi/Desktop# dig stackoverflow.com

; <<>> DiG 9.18.24-1-Debian <<>> stackoverflow.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 3647
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;stackoverflow.com.             IN      A

;; ANSWER SECTION:
stackoverflow.com.      300     IN      A       104.18.32.7
stackoverflow.com.      300     IN      A       172.64.155.249

;; Query time: 168 msec
;; SERVER: 8.8.8.8#53(8.8.8.8) (UDP)
;; WHEN: Fri Apr 05 14:05:58 BST 2024
;; MSG SIZE  rcvd: 78

root@raspberrypi:/home/pi/Desktop# ping 104.18.32.7
PING 104.18.32.7 (104.18.32.7) 56(84) bytes of data.
^C
--- 104.18.32.7 ping statistics ---
6 packets transmitted, 0 received, 100% packet loss, time 5098ms

I also cannot seem to ping 1.1.1.1 ( Cloudflare public DNS ):

root@raspberrypi:/home/pi/Desktop# ping -W 3 -c 1 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=115 time=294 ms

--- 8.8.8.8 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 294.368/294.368/294.368/0.000 ms
root@raspberrypi:/home/pi/Desktop# ping -W 3 -c 1 8.8.4.4
PING 8.8.4.4 (8.8.4.4) 56(84) bytes of data.
64 bytes from 8.8.4.4: icmp_seq=1 ttl=57 time=181 ms

--- 8.8.4.4 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 181.163/181.163/181.163/0.000 ms
root@raspberrypi:/home/pi/Desktop# ping -W 3 -c 1 1.1.1.1
PING 1.1.1.1 (1.1.1.1) 56(84) bytes of data.

--- 1.1.1.1 ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms

root@raspberrypi:/home/pi/Desktop#

Here are the traceroute results:

root@raspberrypi:/home/pi/Desktop# traceroute 8.8.8.8
traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 60 byte packets
 1  * * *
 2  * * *
 3  * * *
 4  * * *
 5  * * *
 6  * * *
 7  * * *
 8  * * dns.google (8.8.8.8)  571.410 ms
root@raspberrypi:/home/pi/Desktop# traceroute google.com
traceroute to google.com (142.251.163.100), 30 hops max, 60 byte packets
 1  * * *
 2  * * *
 3  * * *
 4  * * *
 5  * * *
 6  * * *
 7  * * *
 8  * * *
 9  * * *
10  * * *
11  * * *
12  * * *
13  * * *
14  * * *
15  * * *
16  * * *
17  * * *
18  * * *
19  * * *
20  * * *
21  * * *
22  * * *
23  * * *
24  * * *
25  * * *
26  * * *
27  * * *
28  * * *
29  * * *
30  * * *
root@raspberrypi:/home/pi/Desktop# traceroute -n google.com
traceroute to google.com (142.251.163.101), 30 hops max, 60 byte packets
 1  * * *
 2  * * *
 3  * * *
 4  * * *
 5  * * *
 6  * * *
 7  * * *
 8  * * *
 9  * * *
10  * * *
11  * * *
12  * * *
13  * * *
14  * * *
15  * * *
16  * * *
17  * * *
18  * * *
19  * * *
20  * * *
21  * * *
22  * * *
23  * * *
24  * * *
25  * * *
26  * * *
27  * * *
28  * * *
29  * * *
30  * * *
root@raspberrypi:/home/pi/Desktop#

Update 2:

I tried a different board that I had with a PCIe Quectel EC25 modem and it can ping google through that interface. I double checked everything I could think of between that one and the Sixfab hat - and found no errors. But the Sixfab one cannot ping google ( please see the output below as a comparison of the routes and everything else between the two ).

Could this be a service level DNS thing not related to the actual Linux configuration?

Working other board:

root@iot-gate-imx8plus:~# qmicli -d /dev/cdc-wdm0 --wds-get-current-settings
[/dev/cdc-wdm0] Current settings retrieved:
           IP Family: IPv4
        IPv4 address: 10.204.79.165
    IPv4 subnet mask: 255.255.255.252
IPv4 gateway address: 10.204.79.166
    IPv4 primary DNS: 8.8.8.8
  IPv4 secondary DNS: 8.8.4.4
                 MTU: 1500
             Domains: none
root@iot-gate-imx8plus:~#
root@iot-gate-imx8plus:~# ifconfig wwan0
wwan0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST>  mtu 1500
        inet 10.204.79.165  netmask 255.255.255.252  destination 10.204.79.165
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 1000  (UNSPEC)
        RX packets 1538  bytes 197923 (193.2 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1374  bytes 171063 (167.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

root@iot-gate-imx8plus:~# ip route
default via 10.204.79.166 dev wwan0 metric 10
10.2.0.0/16 dev wg0 scope link
10.204.79.164/30 dev wwan0 proto kernel scope link src 10.204.79.165
root@iot-gate-imx8plus:~#
root@iot-gate-imx8plus:~# ping google.com
PING google.com (142.250.180.14) 56(84) bytes of data.
64 bytes from lhr25s32-in-f14.1e100.net (142.250.180.14): icmp_seq=1 ttl=112 time=236 ms
64 bytes from lhr25s32-in-f14.1e100.net (142.250.180.14): icmp_seq=2 ttl=112 time=275 ms
64 bytes from lhr25s32-in-f14.1e100.net (142.250.180.14): icmp_seq=3 ttl=112 time=243 ms
64 bytes from lhr25s32-in-f14.1e100.net (142.250.180.14): icmp_seq=4 ttl=112 time=274 ms
^C
--- google.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3003ms
rtt min/avg/max/mdev = 236.348/257.205/275.411/17.489 ms
root@iot-gate-imx8plus:~# cat /etc/resolv.conf
# This is /run/systemd/resolve/resolv.conf managed by man:systemd-resolved(8).
# Do not edit.
#
# This file might be symlinked as /etc/resolv.conf. If you're looking at
# /etc/resolv.conf and seeing this text, you have followed the symlink.
#
# This is a dynamic resolv.conf file for connecting local clients directly to
# all known uplink DNS servers. This file lists all configured search domains.
#
# Third party programs should typically not access this file directly, but only
# through the symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a
# different way, replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.

nameserver 8.8.8.8
nameserver 8.8.4.4
search .

Sixfab HAT failing DNS:

root@raspberrypi:/home/pi/Desktop# qmicli -d /dev/cdc-wdm0 --wds-get-current-settings
[/dev/cdc-wdm0] Current settings retrieved:
           IP Family: IPv4
        IPv4 address: 100.75.157.67
    IPv4 subnet mask: 255.255.255.248
IPv4 gateway address: 100.75.157.68
    IPv4 primary DNS: 8.8.4.4
  IPv4 secondary DNS: 8.8.8.8
                 MTU: 1360
             Domains: none
root@raspberrypi:/home/pi/Desktop#
root@raspberrypi:/home/pi/Desktop# ifconfig wwan0
wwan0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST>  mtu 1360
        inet 100.75.157.67  netmask 255.255.255.248  destination 100.75.157.67
        inet6 fe80::b750:b71f:6494:4e58  prefixlen 64  scopeid 0x20<link>
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 1000  (UNSPEC)
        RX packets 153  bytes 16644 (16.2 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 47348  bytes 8168507 (7.7 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

root@raspberrypi:/home/pi/Desktop#
root@raspberrypi:/home/pi/Desktop# ip route
default via 100.75.157.68 dev wwan0 metric 10
100.75.157.64/29 dev wwan0 proto kernel scope link src 100.75.157.67
root@raspberrypi:/home/pi/Desktop#
root@raspberrypi:/home/pi/Desktop# ping -I wwan0 -W 3 -C 3 google.com
PING google.com (142.251.163.100) from 100.75.157.67 wwan0: 56(124) bytes of data.
^C
--- google.com ping statistics ---
19 packets transmitted, 0 received, 100% packet loss, time 18431ms

root@raspberrypi:/home/pi/Desktop#
root@raspberrypi:/home/pi/Desktop# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=115 time=118 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=115 time=116 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=115 time=115 ms
^C
--- 8.8.8.8 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 115.051/116.219/117.650/1.077 ms
root@raspberrypi:/home/pi/Desktop# cat /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
search .
root@raspberrypi:/home/pi/Desktop#

Update 3:

I installed tshark, and then monitored wwan0 while I tried to ping google in a different terminal. It is interesting that the DNS response is received on the interface, but the ping then is never responded to.

root@raspberrypi:/home/pi/Desktop# tshark -i wwan0
Running as user "root" and group "root". This could be dangerous.
Capturing on 'wwan0'
 ** (tshark:456216) 20:56:56.160995 [Main MESSAGE] -- Capture started.
 ** (tshark:456216) 20:56:56.161146 [Main MESSAGE] -- File: "/tmp/wireshark_wwan05F4ZL2.pcapng"
    1 0.000000000 100.75.157.67 → 8.8.8.8      DNS 56 Standard query 0x4501 A google.com
    2 0.000025703 100.75.157.67 → 8.8.8.8      DNS 56 Standard query 0x6c0c AAAA google.com
    3 0.287190564      8.8.8.8 → 100.75.157.67 DNS 168 Standard query response 0x6c0c AAAA google.com AAAA 2607:f8b0:4004:c1b::8b AAAA 2607:f8b0:4004:c1b::71 AAAA 2607:f8b0:4004:c1b::66 AAAA 2607:f8b0:4004:c1b::8a
    4 0.287191675      8.8.8.8 → 100.75.157.67 DNS 152 Standard query response 0x4501 A google.com A 142.251.163.138 A 142.251.163.102 A 142.251.163.101 A 142.251.163.100 A 142.251.163.113 A 142.251.163.139
    5 0.287529002 100.75.157.67 → 142.251.163.138 ICMP 84 Echo (ping) request  id=0xb5fb, seq=1/256, ttl=64
3
  • 2
    This is an XY question - DNS is working fine - if you look at the result for PING google.com (142.251.163.139) the IP address is resolved - it is ping that is not working. This could be because that host is down, or because of a firewall or routing issue or something else - but the DNS is resolving to 142.251.163.139. Maybe the next step would be to do a traceroute to 142.251.163.139. For what tiny bit its worth that IP responds to ping for me.
    – davidgo
    Commented Apr 5 at 2:00
  • 1
    Also, there is an anomily with your script. Where you have echo "nameserver 8.8.4.4" > /etc/resolv.conf" you are overwriting the old setting for nameserver.conf - you probably mean to append it, so you need an extra > - so maybe it should read echo "nameserver 8.8.4.4" >> /etc/resolv.conf" (This is not the cause of your problem however)
    – davidgo
    Commented Apr 5 at 2:01
  • @davidgo Thanks for catching the script anomaly. I have fixed that. I just tried to ping 145.251.163.139, and that fails - interesting... I have no idea why I could ping 8.8.8.8 but not the DNS Resolved IP Address for the host I am trying to reach.
    – PhilBot
    Commented Apr 5 at 13:04

0

You must log in to answer this question.

Browse other questions tagged .