How To Make Changes In resolv.conf Permanent in Ubuntu

0
1296

When you change the DNS configuration using /etc/resolv.conf file, you must have noticed that the changes are not permanent. A reboot and your changes might revert to the original settings. I had this issue when I changed the DNS setting to one of our collegue. Editing resolv.conf solved the problem but for the moment only. My changes were not permanent and when I looked at resolv.conf file again, I found why it is so. The file clearly mentioned it and I did not pay attention to it:

 
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8) # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN

So, as said, my changes were overwritten. Editing resolv.conf is good for instant testing but the question arises how to make changes in resolv.conf permanent in Ubuntu or any other Linux system.

In this quick tip, I’ll discuss the solution that you could use to make the changes in resolv.conf permanent.

Make permanent changes in resolv.conf:

This workaround needs a program resolvconf to be installed in your system. Normally this program is installed in many Linux systems by default but to make sure it is, use the following command in terminal (Ctrl+Alt+T ) in Ubuntu:

 sudo apt-get install resolvconf 

Once you have made sure that the resolvconf is installed, edit the configuration file using the following command:

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

Save it. Now the settings in resolv.conf will be permanent. or you can run “resolvconf -u” to test the new config and see the result at /etc/resolv.conf

LEAVE A REPLY

Please enter your comment!
Please enter your name here