Why is dnsmasq putting the router IP in /etc/resolv.conf instead of 127.0.0.1

dnsdnsmasqresolvconf

I'm having DNS resolution issues in various contexts which appear to trace back to my networking configuration.

I'm running just the dnsmasq-base installation of dnsmasq on two Linux installations (Lubuntu 12.04 and 12.10). I haven't done anything in particular to configure dnsmasq, but I think some other changes I made previously may have lead to an incorrect configuration when upgrading.

The working configuration on machine 'A' running 12.04 sets /etc/resolv.conf to use 127.0.1.1 (which in /etc/hosts is set to $HOSTNAME) On machine 'B' where certain applications such as OpenVPN experience DNS resolution issues, /etc/resolv.conf is set to 192.168.1.1, which is my gateway IP. Only certain applications are affected. Web-browsing, for example, works just fine.

Any idea if this difference is the cause of the DNS resolution issues, and why 'B' is behaving differently?

Edits:

Both 'A' and 'B' are running dnsmasq, both are using DHCP to get DNS configuration, and I'm only using dnsmasq for DNS.

There is no /etc/dnsmasq.conf file. I understand that this is normal when running just dnsmasq-base.

The contents of /etc/resolvconf on the two machines appear to be identical. No extraneous/missing files.

Sorry I can't be more specific about the nature of the problem. "DNS resolution issue" was the end-point of my discussion with technical support at my VPN provider.

Best Answer

On machine B, if /etc/NetworkManager/NetworkManager.conf contains dns=dnsmasq then resolv.conf should contain only one "nameserver" line, namely nameserver 127.0.1.1. 127.0.1.1 is the address where the NetworkManager-controlled local forwarding nameserver listens. NetworkManager gives that nameserver forwarding addresses to use.

Try running sudo dpkg-reconfigure resolvconf on machine B. This will restore the needed symbolic link from /etc/resolv.conf to ../run/resolvconf/resolv.conf.

Are you running a third-party VPN client? Such clients are known to clobber /etc/resolv.conf and not to restore it when they exit. You may have to do sudo dpkg-reconfigure resolvconf every time you stop such a client.

Another thing to try is: comment out dns=dnsmasq in /etc/NetworkManager/NetworkManager.conf and then reboot. This disables the NetworkManager-controlled local forwarding nameserver which has some known issues.

Related Question