w
w
Linux

How to make resolv.conf changes permanent

145 Views

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 1.1.1.1:

nameserver=1.1.1.1

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

https://itsfoss.com/resolvconf-permanent-ubuntu/

https://support.rackspace.com/how-to/changing-dns-settings-on-linux/

Credit

Original photo by Christopher Burns on Unsplash

Categories: Linux

Ordinal Walker

P-S-C-D-W

0 Comments

Leave a Reply