Disabling dnsmasq as Your Local DNS Server in Ubuntu

You caught me, I’m dabbling in Ubuntu again. I know! I’m weak for the pretty.

Their inclusion of dnsmasq by default, and making network-manager dependent upon it, is fine – I mean it’s their distribution. But, Ubuntu, make sure you get things right before you force it down people’s throats. Ah, pretty Ubuntu, though. It’s okay.

So, dnsmasq turns every workstation into its own caching DNS server. The cache isn’t updating very well on mine, though – I’m not even getting new additions to domain zones, let alone deletions or changes.

I don’t need my workstation to be a DNS server. I have DNS servers for that. But every time I change /etc/resolv.conf, it gets overwritten later by resolvconf (of course). You’d think resolvconf would believe my DHCP server, and use the DNS entries received from it — but no, resolvconf believes the big, nasty Network-Manager, which says DNS resolution will come from 127.0.0.1 – and dnsmasq will provide it.

And of course, since Ubuntu decided to have every person’s workstation become a name server and DHCP server, they make it destroy the whole dependency tree for Network-Manager if you remove dnsmasq.

I just want nice accurate DNS information… not stale cache… that never seems to die!

So here is what I did to wrest my name servers back from Ubuntu’s presumptuous, yet sumptuous, little fingers.

  1. sudo gedit /etc/NetworkManager/NetworkManager.conf
  2. Comment out the “dns=dnsmasq” line by putting a hash “#” in front it.
  3. sudo service network-manager restart

After that, /etc/resolv.conf was populated with the DNS servers my DHCP server wanted me to have in the first place, and DNS resolution was back to the happy mess it always is.

I have to say, out of some embarrassment, that I don’t actually use gedit for such things. I just put gedit there so I wouldn’t confuse anyone with emacs.