/etc/resolv.conf, resolvconf, NetworkManager (and systemd-resolved?) Not Working

I ran some updates, and the name service stopped resolving. My LAN has a local nameserver to resolve domain names for virtual machines.

It turns out the /etc/resolv.conf file was overwritten, and a program called resolvconf had taken it over. resolvconf centralizes updating the resolv.conf file from several different programs that might want to change the file, like NetworkManager, ifup, ifdown, and dhclient.

There are a couple fixes. The one I chose was to replace resolv.conf.

You can turn off this feature by running dpkg-reconfigure resolvconf.

Then do this:

dpkg-reconfigure resolvconf
rm /etc/resolv.conf
echo nameserver 192.168.111.2 > /etc/resolv.conf
echo search riceball.lo >> /etc/resolv.conf

Fixing the Network Manager’s Caching Server

I decided to read the code to see what could be happening. I think the problem is related to a NetworkManager name caching plugin.

In the NetworkManager, if the NetworkManager’s cache plugin is installed, the list of nameservers is replaced with “127.0.1.1”.

This is where the cache plugin is announced..

The problem is, the plugin uses dnsmasq. If you uninstall dnsmasq, the resolver stops working, but Network Manager thinks it’s still there. So you need to comment it out of /etc/NetworkManager/NetworkManager.conf. There is more info here.

Make sure to run dpkg-reconfigure resolvconf to re-establish the symlink. Then sudo service NetworkManager restart, and select your network link.

Leave a Reply