How to prevent /etc/resolv.conf from getting overwritten after reboot in Ubuntu 11.10?

mkhezr picture mkhezr · Mar 12, 2013 · Viewed 36.8k times · Source

I'm using Ubuntu 11.10 and I manually configure DNS servers in /etc/resolv.conf but it gets somehow overwritten after I reboot. How can I prevent this?

Thanks.

Answer

Abdallah Ben Salem picture Abdallah Ben Salem · Feb 26, 2015

As you can read in the header of resolv.conf :

Dynamic resolv.conf file for glibc resolver generated by resolvconf

So, the resolv.conf is generated, if you want to keep the resolvconf configuration after reboot, you will have to edit /etc/resolvconf/resolv.conf.d/base. In that file, put in your info as you would in resolv.conf.

nameserver 8.8.8.8

Then regenerate resolv.conf with resolvconf:

sudo resolvconf -u