How to Make Changes in /etc/resolv.conf Permanent

I’m not good at using my ISP’s DNS Servers because last time I did, it wasn’t always up. I browse on a mobile network, so decided to be using another DNS servers which are always up all time… I use either Google DNS or OpenDNS and changing DNS servers in Linux is editing the /etc/resolv.conf and prepend your new DNS server IP to it in this format


Where is your DNS IP, this is how DNS server is changed in Linux.

This change you did in /etc/resolv.conf won’t be permanent when you have resolvconf package installed in your system, which some Linux distros come with it (e.g. Ubuntu). resolvconf package alters the /etc/resolv.conf and automatically generates your ISP’s DNS to the /etc/resolv.conf whereby purging any setting in it. So how to make your own settings permanent is placing your server in the header file of the auto generated one by typing:

$ sudo nano /etc/resolvconf/resolv.conf.d/head

and prepend your DNS Server to it like


and save.

Next time a new setting is generated to replace the /etc/resolv.conf your own DNS server heads in as the first which makes it the primary server and permanent.