Home » Linux » How to make sure /etc/resolv.conf file not get updated on boot

How to make sure /etc/resolv.conf file not get updated on boot

Last updated Sep 4, 2021

Are you facing any problem with /etc/resolv.conf file when it automatically reset on boot, and all custom configuration get varnish from the file?

In early days, when I was rebooting my Linux machine after some time realize I am not getting any email, alert from the server and in the log getting host not found then only go to the resolv.conf file and edit it to mention my DNS server.

Every day I thought why it not saved permanently when I edit the /etc/resolv.conf file.

And one day when I saw on top of the page, Oh.. I was too stupid. There are already written in the file.

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)

Now I just started to find why it is happening and how to make /etc/resolv.conf file permanent.

The file /etc/resolv.conf gets changed on every boot; this file is configured by the network service of the Linux system dynamically, and the DHCP service updates DNS parameter.

So, the DHCP service is only responsible for removing my DNS configuration from /etc/resolv.conf file.

Now, It’s time to work on the solution for this issue.

Whenever I am working to found solution for any problem, first I speak with myself to understand if I solve the issue how much time it will save for me in future and my answer is going to help others?

When I got the answer to my above question, I am getting the motivation to solve the problem?

In this case, I found if I solve this issue, my server will work smoothly and no need to remind to configure “/etc/resolv.conf” file on every boot. So, yes It will save my time on every boot of Linux machine.

Now I started to work around solution for making /etc/resolv.conf file permanent with custom configuration.

To achieve this solution, we found the various method which can make resolv.conf file static or permanent.

Some of the methods are here:

Method 1 – Using DHCP configuration file

You can change the DHCP configuration file (dhclient.conf) for configuring static DNS for the system. The DHCP configuration file location is /etc/dhcp/dhclient.conf; you can find the below line in the file:

# supersede domain-name "fugue.com home.vix.com";
# prepend domain-name-servers;

You need to remove the comment symbol ‘#’ from the beginning of the line and enable it with your domain-name and domain-name-server parameter which you want and save the file.

Now your system DNS configuration will always be static even on the boot of the system.

Method 2 – Using resolvconf package

There is one another alternate option to make static DNS for your Linux system is using the “resolvconf” tool.

To use the “resolvconf” tool, you need first to install this tool in your system, as shown below.

$ sudo apt-get install resolvconf

The above command you can use in Ubuntu Linux to install “resolvconf” tool.

Once “resolvconf” installed in your system need to edit the configuration file in below location:


After configuring your DNS in the file, save it and close.

Now your permanent and static DNS is configured for the system.

I hope, now your issue related with /etc/resolv.conf will solve, and you will get sweet dreams every night.

Related Posts

Creating a lame utility HTTP server in Linux Operating System

In this article, we will discuss the cURL tool in Linux. The cURL tool is used for transferring the data from or to a server. It supports many protocols, and http is one of them. cURL is used to transfer the data from URL. It has so many tricks to offer, such as http...

Finding binary dependencies in Linux Operating System

In this article, we are going to check the executable. We will find out which string is present in it by using the string command.PrerequisitesBesides having a terminal open, make sure you have a binary present in your directory.Find dependencies First, we...

Capturing network traffic headlessly in Linux Operating System

In this article, we are going to learn how to capture traffic. We are going to capture network traffic with a packet sniffer tool called tcpdump. This tool is used to filter or capture TCP/IP packets that are transferred or received over a network.PrerequisitesBesides...

Follow Us

Our Communities

More on Linux

The Ultimate Managed Hosting Platform
Load WordPress Sites in as fast as 37ms!



Submit a Comment

Your email address will not be published. Required fields are marked *

18 − two =