Working with resolvconf on Ubuntu

Trying to update your nameservers the old fashioned way can be a headache on Ubuntu. There is this thing called resolvconf that likes to change your settings back when you reboot. So for future reference, here’s what I found.

First of all, as with any normal linux install, nameservers are spelled out in the file “/etc/resolv.conf” however this now includes the ominous warning
# 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

There is a folder /etc/resolvconf/resolv.conf.d/ with 3 files; “base”, “head” & “original”. The warning above actually comes from this head file. In the base file you should add the nameservers on lines like:


nameserver 192.168.1.1
nameserver 192.168.1.2

Then if you run ‘resolvconf -u‘ your nameservers will update to include those from the base file. However you may get some additional nameservers showing up, if you have them designated in /etc/network/interfaces with the “dns-nameservers” option, eg

dns-nameservers 192.168.1.11 192.168.1.12

If you have the same nameservers set in both places (the base file and the interfaces file) they will only show up once in /etc/resolv.conf

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *