I’m running a setup where my device connects to the internet via a modem, and I’m frequently encountering the following error:
{:error, :nxdomain}
I suspect that the default DNS server being used is too slow or unreliable. As a simple fix, I’d like to manually set a faster DNS server, such as 1.1.1.1
(Cloudflare) or 8.8.8.8
(Google). However, I haven’t been able to figure out how to configure this for my modem connection.
If that doesn’t solve the issue, I assume I’ll need to look into caching DNS responses somehow.
System Details
- Hardware: Raspberry Pi Zero 2 W running Nerves
- Modem: Quectel BG96 connected to the Pi via USB
- Networking: Using
VintageNetQmi
to communicate with the modem - Connections:
- The Pi connects via the modem and WebSockets to Nerves Cloud
- The Pi connects via the modem and WebSockets to my Phoenix server
Configuration Details
This is the configuration I’m using to set it up:
{"wwan0",
%{
type: VintageNetQMI,
vintage_net_qmi: %{
only_radio_technologies: [:lte],
service_providers: [
%{apn: "m2m.movistar.es"},
%{apn: "eapn1.net"}
]
},
ipv4: %{
method: :dhcp,
name_servers: ["1.1.1.1", "8.8.8.8", "9.9.9.9"]
}
}}
When I run VintageNet.info, I see the following output for the wwan0 interface:
Interface wwan0
Type: VintageNetQMI
Present: true
State: :configured (1:31:35)
Connection: :internet (1:31:14)
Addresses: 100.106.199.53/30, fe80::bb8b:1609:7dc4:e54e/64
MAC Address: nil
Configuration:
%{
type: VintageNetQMI,
ipv4: %{
method: :dhcp,
dhcpd: %{options: %{dns: ["1.1.1.1", "8.8.8.8", "9.9.9.9"]}}
},
vintage_net_qmi: %{
service_providers: [%{apn: "m2m.movistar.es"}, %{apn: "eapn1.net"}],
only_radio_technologies: [:lte]
}
}
However, when I check the system’s resolver configuration (using cat /etc/resolv.conf), it shows:
# This file is managed by VintageNet. Do not edit.
nameserver 10.4.0.240 # From wwan0
nameserver 10.4.0.230 # From wwan0
nameserver 10.144.21.239 # From wlan0
I don’t actually know if my DNS settings have taken effect.
Additional Context
• The device works much more reliably on Wi-Fi, likely due to the higher speeds, but I can’t rely on Wi-Fi since the device will be using the modem in the field.
• The issue varies over time—sometimes it works fine, and other times I get persistent NXDOMAIN errors.
• Both my Phoenix server and Nerves Cloud seem equally affected, though it’s hard to confirm since when I lose access to Nerves Cloud, I can’t troubleshoot further.
My Questions
-
How can I manually configure a faster DNS server for this setup? I tried setting it in the config, but it doesn’t seem to be applied in /etc/resolv.conf.
-
If that doesn’t work, what are some good strategies for DNS caching to improve reliability?
-
Has anyone encountered {:error, :nxdomain} when using VintageNetQmi with a Quectel BG96 modem?
-
Are there any additional debugging steps I can take to confirm whether the issue is strictly DNS-related or if it might be something else?
Any advice would be greatly appreciated!