[Dnsmasq-discuss] Multiple Resolv Files?

Simon Kelley simon at thekelleys.org.uk
Tue Nov 25 21:04:33 GMT 2008

Petri Savilahti wrote:
>>>What if the primary link (/etc/resolv.conf) goes down? Dnsmasq will
>>>not get any replies using nameservers from this file. Does dnsmasq
>>>automatically read then the /etc/ppp/resolv.conf?
>>dnsmask reads all specified files on startup, creates a list of upstream dns
>>servers, then chooses the one which "works best" (first querys go round robin,
>>to measure). If this choosen server goes down, it reelects another one from its
>>list. Additionally, if any resolvfile gets rewritten while dnsmask is running,
>>it rereads the file and updates its list.
>>Its simple as this, but it is not simple to say which server dnsmask will choose ;)
> I tried this with the latest dnsmasq-2.46 and can't get it working. I
> configured a static
> configuration (IP address and /etc/resolv.conf) for the ADSL
> connection and dynamic
> DHCP configuration (IP address and /var/run/ppp/resolv.conf) for the
> mobile connection.
> I have the following lines in my dnsmasq.conf
> resolv-file=/etc/resolv.conf
> resolv-file=/var/run/ppp/resolv.conf.
> log-queries.
> When I reboot my machine I get the following lines to my /var/log/messages:
> daemon.info dnsmasq[2862]: started, version 2.46 cachesize 150
> daemon.warn dnsmasq[2862]: overflow: 7 log entries lost
> daemon.info dnsmasq[2862]: using nameserver X.Y.182.230#53
> daemon.info dnsmasq[2862]: using nameserver X.Y.180.230#53
> and 5 sec later  when the mobile connection starts:
> daemon.info dnsmasq[2862]: reading /var/run/ppp/resolv.conf
> daemon.info dnsmasq[2862]: using nameserver Z.M.0.47#53
> daemon.info dnsmasq[2862]: using nameserver Z.N.54.100#53.
> Dnsmasq will forward only to the last two DNS  servers (Z.M.0.47 and
> Z.N.54.100) even
> if it would not get any response from them (mobile connection down).
> The first two
> nameservers (X.Y.182.230 and X.Y.180.230) are not even tried.
> Any help would be appreciated.
> - Petri

Dnsmasq uses only one resolv-file at a time, and uses the one which 
changed last. That explains what you are seeing: 
/var/run/ppp/resolv.conf changed last, so it gets used.

When you say the your connections "go down" are they actually being 
removed, or just not working? If you can arrange so that you use one 
connection at a time, then you can make pppd or DHCP or whatever touch a 
  resolv file as the connection comes up, and dnsmasq's resolv-file 
reading logic will work.

If both connections are there all the time, but sometime the DNS servers 
just don't respond, then the best thing to do is to put all the possible 
nameservers into a static resolv.conf or /etc/dnsmasq.conf. Dnsmasq will 
  start by sending a query to all the servers and then use the one which 
answers first.



More information about the Dnsmasq-discuss mailing list