Linux : Managing resolv.conf with resolvconf on Ubuntu

By | July 24, 2015

Lately, Ubuntu introduced “resolvconf” which manage and maintain the legacy “/etc/resolv.conf” file. As stated in the comment of this file, any manual editing will be lost, so by default you have to use resolvconf to manage it.

You will find the following text files under /etc/resolvconf/resolv.conf.d :

base : used when no data can be found
head : header for resolv.conf
original : backup of resolv.conf
tail : anything in that file will be append to resolv.conf (this is here you should edit or add nameservers)

So let’s say you’d like to add “nameserver 8.8.8.8” and make it effective, simply edit :

/etc/resolvconf/resolv.conf.d/tail

Add :

nameserver 8.8.8.8

Then regenerate resolv.conf using resolvconf :

sudo resolvconf -u

You will now see your changes in /etc/resolv.conf.