NXDOMAIN Issues with Modem – How to Set a Faster DNS Server?

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

  1. 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.

  2. If that doesn’t work, what are some good strategies for DNS caching to improve reliability?

  3. Has anyone encountered {:error, :nxdomain} when using VintageNetQmi with a Quectel BG96 modem?

  4. 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!

nxdomain is a system error that means the DNS server could not be reached. Since you said the issue is intermittent and both Phoenix and Nerves Cloud are also affected, it sounds like you may be in a location with poor cell signal. You can find the signal strength (signal_dbm) with VintageNet.info. The less negative the number, the better. Some ways to mitigate this in development are:

  • Repositioning the antenna for development
  • Using a better antenna for development (passive gain)
  • Adding a cellular signal booster to the area

If you change the antenna in production though, you’ll need to go through compliance again.

Since the BG96 is both CAT-M and NB-IOT, you could also check the manual on how to disable NB-IOT for this modem since it is painfully slow for typical Nerves systems. That way the modem will only connect via CAT-M.

And since you asked, if you need to add name servers, the VintageNet property is additional_name_servers.

2 Likes

Is this kind of thing legal?

Yes, cell boosters are legal (in the US). Active jamming is illegal. HiBoost makes residential ones, and large commercial buildings these days have some pretty fancy ones installed.

1 Like