3

Ubuntu 16.04

After moving office I set the DNS settings via Network GUI (see here) to my new values. Internet connection is there, but name resolution seems very slow. My interpretation is, it tries to name-resolve with old settings which times-out after around 5 sec, then tries and succeeds (fast) with new settings.

But whatever I do, the old values are always "in the system" somehow.

After a reboot:

  • /etc/resolvconf/resolv.conf.d/head contains the old DNS addresses
  • /etc/resolvconf/resolv.conf.d/base contains the new DNS addresses
  • /etc/resolv.conf (run/resolvconf/resolv.conf) contains old DNS addresses (from head) followed by values in /run/resolvconf/interface/NetworkManager (which contains localhost and search-parameter)

/etc/network/interfaces does not contain much:

auto lo
iface lo inet loopback

I added the new DNS settings into /etc/dhcp/dhclient.conf without effect.

The only remedy so far is to manually edit /etc/resolv.conf after each boot.

So, question: how can I make Ubuntu forget the old settings (the ones in /etc/resolvconf/resolv.conf.d/head which are auto-generated). No nscd installed. This would seem one way to do it, but I guess there must be a better one.

Not tried option: install dnsmasq and configure as described here (again I think it should be possible without that)

tokosh
  • 195

1 Answers1

2

The /etc/resolv.conf file is generated from the files stored in the /etc/resolvconf/resolv.conf.d directory when sudo resolvconf -u is ran.

If you make any changes to these files:

terrance@terrance-ubuntu:/etc/resolvconf/resolv.conf.d$ ls -l
total 8
-rw-r--r-- 1 root root   0 Jun  3  2015 base
-rw-r--r-- 1 root root 151 Feb 25  2017 head
-rw-r--r-- 1 root root  33 Jun  5  2016 original
-rw-r--r-- 1 root root   0 Jun  5  2016 tail

The changes will be reflected when you run the resolvconf -u command for update. I actually put my DNS information in the original file and I leave all the other files alone:

terrance@terrance-ubuntu:/etc/resolvconf/resolv.conf.d$ cat original 
search local
nameserver 10.0.0.1

Then after running the sudo resolvconf -u command we can see my changes in my /etc/resolv.conf file:

$ cat /etc/resolv.conf 
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 10.0.0.1
search local

EDIT: One more thing you may have to check and change is the line dns=dnsmasq found in the /etc/NetworkManager/NetworkManager.conf file. You can copy and paste the following line to disable using the dnsmasq from the NetworkManager.

sudo sed -i 's/dns=dnsmasq/#dns=dnsmasq/' /etc/NetworkManager/NetworkManager.conf 

After running the above line, reboot the computer for the new changes to take effect.

Hope this helps!

Terrance
  • 43,712