When a Quectel EC25 modem on a Raspberry Pi fails to resolve DNS queries over the wwan0 interface despite having an active data connection, the issue is typically caused by NetworkManager not receiving or applying DNS server addresses provided by the cellular carrier. The most reliable fix involves manually configuring static DNS servers in the NetworkManager connection profile for the modem.
Diagnosing the Connection State
Before modifying configuration files, it is essential to confirm that the data link itself is functional. A common misconception is that a lack of internet access means the modem is disconnected. In reality, the cellular radio may be registered with the network, but the IP layer might be misconfigured or missing critical routing information. First, verify that thewwan0 interface has obtained an IP address. Use the following command to check the interface status:
ip addr show wwan0
You should see an IPv4 address assigned to the interface. If the address is 169.254.x.x, this indicates a link-local address, meaning DHCP failed entirely. However, if you have a valid public or private IP (e.g., 10.x.x.x or 100.64.x.x), the data path is likely established. Next, test basic connectivity using a direct IP ping rather than a domain name:
ping -c 3 8.8.8.8
If this ping succeeds, your routing table and physical connection are correct. The failure is isolated to DNS resolution. You can further inspect the current DNS configuration by running:
resolvectl status wwan0
If this command returns no DNS servers or shows "DNS Servers: none," then NetworkManager has not applied any resolver settings to this connection. This is the core symptom of the problem described in our context.
Configuring Static DNS in NetworkManager
The standard behavior of NetworkManager is to request DNS servers via DHCP from the cellular provider. Many IoT-focused carriers do not push these settings reliably, or the Linux kernel’s PPPoE/NCM driver drops them. The solution is to force specific DNS servers into the connection profile. Identify the exact name of your mobile broadband connection profile. You can list all profiles using:nmtui connect
Or via command line:
nmcli con show
Look for a connection type named "Mobile Broadband" or similar, associated with the Quectel device. Let us assume the connection name is "Quectel-EC25". To update the DNS settings, use the nmcli command to modify the connection properties. Replace "Quectel-EC25" with your actual connection name.
nmcli con mod "Quectel-EC25" ipv4.dns "8.8.8.8 1.1.1.1"
This command explicitly sets Google and Cloudflare DNS servers. It is crucial to also set the method to manual or auto depending on your preference, but usually, leaving the method as auto while providing explicit DNS servers works best. If you encounter issues, you can explicitly set the method:
nmcli con mod "Quectel-EC25" ipv4.method auto
After modifying the profile, you must restart the connection for changes to take effect. Do not just toggle Wi-Fi; you need to bring down and up the cellular interface.
nmcli con down "Quectel-EC25"
nmcli con up "Quectel-EC25"
Once the connection is re-established, verify that the DNS servers are now active:
resolvectl status wwan0
You should now see the IP addresses you configured listed under DNS Servers. Test resolution again:
ping -c 3 google.com
If this resolves successfully, the issue is fixed.
Alternative Solutions and Kernel Considerations
In some cases, particularly with newer kernels like 6.6 mentioned in the context, there may be bugs in the NCM (Network Control Model) driver used by Quectel modems. If the above steps fail, consider checking the kernel logs for errors related to the USB modem:dmesg | grep -i quectel
or
dmesg | grep -i cdc_ether
If you see repeated disconnection/reconnection loops, the modem might be failing at the USB level rather than the DNS level. In such scenarios, adding a udev rule to increase the USB timeout or switching to a different USB port on the Raspberry Pi can help stabilize the link.
Another potential cause is the use of systemd-resolved conflicting with NetworkManager. Ensure that NetworkManager is managing the resolver:
sudo systemctl stop systemd-resolved
sudo systemctl disable systemd-resolved
Then restart NetworkManager:
sudo systemctl restart NetworkManager
This forces NetworkManager to write directly to /etc/resolv.conf, bypassing any potential conflicts with systemd-resolved's stub listener. For more details on managing Raspberry Pi connections, you might find Cannot Connect Raspberry Pi Computer helpful for broader troubleshooting contexts.
Verifying Long-Term Stability
After applying the fix, monitor the connection over several hours. Cellular networks can sometimes drop DNS leases after long periods of inactivity. Setting static DNS ensures that even if the DHCP lease expires or the carrier fails to renew DNS info, your device continues to resolve domains correctly. If you experience intermittent failures, consider implementing a script that monitorsresolvectl status and automatically re-applies the DNS settings if they disappear. This adds resilience to your IoT deployment. Remember that hardware stability, such as ensuring the Quectel EC25 has adequate power supply from the Raspberry Pi, is also critical. Power fluctuations can cause the modem to reset its internal state, leading to temporary loss of service.
For users who prefer graphical management, the nmtui tool provides a text-based interface to perform the same steps outlined above without memorizing command-line syntax. Navigate to "Edit a connection," select your cellular profile, and scroll down to the "IPv4 CONFIGURATION" section to enter the DNS servers manually.
Frequently Asked Questions
Why does ping work but nslookup fails?
This confirms that your IP routing and data connection are healthy, but the system lacks valid DNS server addresses. The operating system cannot translate domain names to IPs because no resolver is configured or reachable on the wwan0 interface.
Can I use the carrier's default DNS instead of Google or Cloudflare?
Yes, but you must first identify what those addresses are. Since the automatic retrieval is failing, you would need to consult your SIM provider's documentation for their primary and secondary DNS IPs and enter them manually using the nmcli commands shown above.
Does this issue affect other interfaces like Wi-Fi?
No, this is specific to the cellular modem configuration. Wi-Fi interfaces typically receive DNS settings correctly from home routers. The problem arises specifically because cellular carriers often do not push DNS information via the NCM protocol, unlike traditional ISPs.
What if nmcli says the connection doesn't exist?
Ensure you are using the exact connection name as displayed by nmcli con show. Names are case-sensitive and may include spaces. You can also use the UUID of the connection if the name is ambiguous by replacing the name with the UUID flag in the command.
Is restarting the Raspberry Pi necessary after changing DNS?
No, restarting the entire device is not required. Toggling the specific connection profile with nmcli con down and up is sufficient and faster. Rebooting only helps if there are deeper system-level caching issues that require a full service restart.