How to make dnsmasq obey the order of servers in resolv.conf

dnsdnsmasq

here's the generated resolv.conf

# Generated by resolvconf
nameserver 127.0.0.1
nameserver 208.67.222.222
nameserver 208.67.220.220
nameserver 192.168.1.1

what's going on in the log appears to be, the resolv.conf before the network is loaded, and then after.

Dec 25 23:17:50 slave-vi dnsmasq[1051]: ignoring nameserver 127.0.0.1 - local interface
Dec 26 11:18:09 slave-vi dnsmasq[1051]: reading /etc/resolv.conf
Dec 26 11:18:09 slave-vi dnsmasq[1051]: using nameserver 208.67.220.220#53
Dec 26 11:18:09 slave-vi dnsmasq[1051]: using nameserver 208.67.222.222#53
Dec 26 11:18:09 slave-vi dnsmasq[1051]: ignoring nameserver 127.0.0.1 - local interface
Dec 26 11:18:23 slave-vi dnsmasq[1051]: reading /etc/resolv.conf
Dec 26 11:18:23 slave-vi dnsmasq[1051]: using nameserver 192.168.1.1#53
Dec 26 11:18:23 slave-vi dnsmasq[1051]: using nameserver 208.67.220.220#53
Dec 26 11:18:23 slave-vi dnsmasq[1051]: using nameserver 208.67.222.222#53
Dec 26 11:18:23 slave-vi dnsmasq[1051]: ignoring nameserver 127.0.0.1 - local interface

my problem is that the routers dns is becoming the primary dns for the system, which is not what I've specified. This is proven by the fact that opendns will return IP's for even BS domains, but I'm not getting that anymore, which means the protection it generally provides is also gone.

Best Answer

You want to un-comment "strict-order" in /etc/dnsmasq.con, as near as I can tell.

# By  default,  dnsmasq  will  send queries to any of the upstream
# servers it knows about and tries to favour servers to are  known
# to  be  up.  Uncommenting this forces dnsmasq to try each query
# with  each  server  strictly  in  the  order  they   appear   in
# /etc/resolv.conf
#strict-order

I'm not sure if dnsmasq ever re-reads its config file or not. You may have to stop/restart dnsmasq.

Related Question