Ubuntu – nameserver in resolv.conf won’t go away!


I've read that I should have nameserver in my /etc/resolv.conf file only if my machine has its own DNS server. Since it doesn't, having it causes problems. But no matter what I do I can not get rid of it!

Here are the things I've done so far:

  1. Adding nameserver to /etc/resolvconf/resolv.conf.d/base file. ( is our network's DNS).
  2. Running: sudo resolvconf --enable-updates.
  3. Running: sudo resolvconf -u.
  4. Running: sudo service network-manager restart (just to make sure).

Yet when I open the /etc/resolv.conf file it says: nameserver! Does anyone have any idea what's wrong?

Please note that it's actually! And I have no idea why it's not!

Even when I update the /etc/resolv.conf manually and change it to anything else, the sudo resolvconf -u will revert it back to! Where is this address coming from?

Best Answer

NetworkManager is the program which (via the resolvconf utility) inserts address into resolv.conf. NM inserts that address if an only if it is configured to start an instance of the dnsmasq program to serve as a local forwarding nameserver. That dnsmasq instance listens for queries at address

If you do not want to use a local forwarding nameserver then configure NetworkManager not to start a dnsmasq instance and not to insert that address. In /etc/NetworkManager/NetworkManager.conf comment out the line dns=dnsmasq

sudo nano /etc/NetworkManager/NetworkManager.conf


and restart the NetworkManager service.

sudo service network-manager restart

In this mode, NetworkManager updates /etc/resolv.conf (still via resolvconf) to include the nameserver addresses NetworkManager has for active connections.

If you want to disable the resolvconf mechanism for updating resolv.conf and just use a static resolv.conf file, do the following.

sudo rm -f /etc/resolv.conf  # Delete the symbolic link
sudo nano /etc/resolv.conf   # Create static file

# Content of static resolv.conf
Related Question