How to make resolv.conf changes permanent


25th January 2020

What is resolv.conf anyway?

First up, resolv.conf is used in most Linux distros, to define the DNS servers that the machine uses for name resolution.? This file is found under the “/etc/resolv.conf” file path. The resolv.conf file should contain at least one nameserver line and each nameserver line defines a DNS server.

Changing resolv.conf

So to change your DNS settings, all you have to do is:  


$ sudo nano /etc/resolv.conf 

Set the nameserver to


Close and save the file and that’s it.

The problem with this method

So changing resolv.conf is fine and all…but know this, every time you restart your machine, the changes will be lost. But fret not there is another way using the program resolvconf.

How to make resolv.conf changes permanent

So this is a bit of a workaround, but it does work. If you don’t have it installed already, install resolvconf:


$ sudo apt-get install resolvconf

Next, execute the following command:


$ sudo gedit /etc/resolvconf/resolv.conf.d/base

Add in the nameserver details as before. Save and close and that’s it, you’ve just persisted your DNS setting changes.

I hope that’s useful.

Related Articles


Original photo by Christopher Burns on Unsplash

Categories: Linux

Ordinal Walker



Leave a Reply