I have a device, in a LAN, behind a router, that runs a linux and need to provide it with an internal DNS server, to resolve names for its own internal applications (it's OpenWRT-based).

The reason to do this is that for some queries, the DHCP-provided stuff doesn't seem to work as expected and some of the client apps get a timeout (sorry for the lack of details, but I'm pretty sure about this as wireshark captures prove some DNS queries are not correctly responded).

I don't intend to run a DHCP server in this device, just local DNS server.

I have a basic knowledge about DHCP, DNS and their handshakings, and I'm not sure how this scenario works with dnsmasq: I configured the DNS server -in the device- with an external public nameserver in its list of servers, expecting (maybe wrongly, I don't know) for it to override the nameservers provided by the DHCP/router/ISP (being the device a DHCP client in this case).

The /etc/resolv.conf file just has the nameserver line, and everything seems to work as I expect.

But what happens if any external DNS is down? Will it fallback to that provided by the DHCP handshaking?

I think put in other words the question would be: when dnsmasq has a list of servers, will it use the DHCP DNS settings?

Hope this is clear.


From what I could see, it seems that dnsmasq works this way:

  • it puts itself as the dns server to use in the regular resolv file (for instance, in my OpenWRT installation, it's /tmp/resolv.conf);
  • it starts with an option to set a resolv file (--resolv-file, pointing to /tmp/resolv.conf.auto in OpenWRT), for its internal use, where custom name servers and those provided by the DHCP server are set in a list.

So, in short, it keeps track of all name servers.

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.