How To Make Changes In resolv.conf Permanent in Ubuntu?

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 watch Netflix outside USA. Editing resolv.conf solved my problem but for the moment only. My changes were not permanent and when I looked at resol.conf file again, I found why it is so. The file clearly mentioned it and I did not pay attention to it:

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:

To make the DNS related changes in resol.conf permanent, you need to change the DHCP configuration file named dhclient.conf. You can find the file in this location: /etc/dhcp/dhclient.conf

You’ll see lines like these:

Remove the preceding “#” and use the domain-name and domain-name-servers which you want. Save it. Now the DNS related changes will be permanent.

Alternate workaround to 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:

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

Save it. Now the settings in resolv.conf will be permanent. I hope this quick tutorial helped you in changing DNS settings and making those changes permanent. Any questions, suggestions, a word of thanks are welcomed

Soure: itsfoss.com

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.