How to Set Permanent DNS Nameservers on Debian 11.3

How to Set Permanent DNS Nameservers on Debian 11.3

In this article, we will discuss how to set permanent DNS nameservers on Debian 11.3, so keep reading to know everything about it. 

The domain name service (DNS) is used to convert an internet protocol (IP) address to a domain name and vice versa. In every system, you specify a DNS server to be used for name resolution. However, when a user tries to manually set a domain name server in Debian or Ubuntu, these settings don’t remain permanent and reset after a reboot. 

The network manager overwrites these changes. To resolve this issue, you must install and use the resolvconf utility to make these changes permanent. This article will show how to set permanent DNS name servers on Debian. The guide discusses the concept of DNS and then the steps for the configuration of the DNS server permanently.

What is a DNS service?

The term DNS stands for domain name service. The current internet system works on an internet protocol (IP) address. However, it is difficult for a layperson to remember these IP addresses based on numbers. Hence, an easy-to-use domain name refers to servers and other machines on the internet. 

However, this requires the translation of these domain names to IP addresses. This is the responsibility of the domain name server. Setting a DNS server in your system may lead to the following advantages:
a) This may increase the performance of your system
b) The system’s security improves c) This may block some of the websites via DNS using a geo-blocking service.

The /etc/resolv.conf file in Linux

The /etc/resolv.conf is the configuration file used to resolve the domain names in Linux. The resolver is primarily a set of libraries that check entries in /etc/hosts files, different DNS servers or use the database of network information service (NIS). 

This article discusses how we can use the resolvconf program to set permanent DNS name servers in /etc/resolv.conf in Debian distributions. You can edit the /etc/resolv.conf file for the following reasons:
a) The DNS settings are not improperly configured
b) You may want to use your name servers. 

A quick overview of /etc/resolv.conf file can be obtained by using the following command:

$cat /etc/resolv.conf

Following is a sample snapshot of the /etc/resolv.conf file:

 snapshot of the /etc/resolv.conf file

Setting up a name server permanently in Linux requires making changes to the /etc/resolv.conf file, as discussed in the next section.

Free DNS provider

To install the resolvconf package required for permanently specifying name servers, you should first add your name servers in /etc/resolv.conf file to the following entries. Otherwise, you will need access to the Ubuntu repository over the internet.


The DNS server mentioned above is a free DNS service provided by Google. Alternatively, you can use other DNS servers such as Open DNS,, level3, Norton, Comodo, VeriSign, etc.

Setting a permanent DNS server in Debian

We will now discuss how we can set the DNS server permanently in Debian. The following are the main steps to be performed.

Check your operating system

First, check which operating system (OS) you are currently using via the following command:

$lsb_release -a

After running the above command, you should see the details of the Debian operating system.

Check if resolvconf is installed

Now, install the resolvconf package if it is not installed previously. It depends on which particular version of the operating system you are using. You may check if the resolvconf is installed on your system by using the following command:

$ sudo systemctl status resolvconf.service

If you get the following message, then the resolvconf is not installed on your system:

Unit: resolvconf.service could not be found

Alternatively, you may get the following message. In that case, the software is installed on your system:

Active: active (exited)

Install resolvconf

First, update your system by typing the following command on your Terminal:

$ sudo apt update

Then install resolvconf package via the following command:

$ sudo apt install resolvconf

Start resolvconf

After the installation, you can start the resolvconf service by using the following command:

$ systemctl start resolvconf.service

In addition, enable the resolvconf service to start on system boot by using the following command:

$ systemctl enable resolvconf.service

Check the status of resolvconf

Finally, check the status of resolvconf service using the following command:

$ systemctl status resolvconf.service

Enter the name servers in resolv.conf

Now, enter the nameservers in the resolv.conf file by using the following command:

$ nano /etc/resolvconf/resolv.conf.d/head

Add the following lines to the file:


Update resolv.conf

Update the resolv.conf file by using the following command:

$resolveconf -u

Check the nameserver entry in resolv.conf by using the following command:

$nano /etc/resolv.conf

This article discussed how to permanently set the domain name service (DNS) server in Debian. When you specify the name server manually, these settings are wiped out on the next boot. The article discussed how we could permanently set up these changes by installing the resolvconf service. 

In addition, any public domain name server provided by Google is used. A step-by-step instruction for setting up a domain name server is also provided.

If this guide helped you, please share it.

Leave a Reply
Previous Article
How to Install ERPNext on Rocky Linux 9 3

How to Restrict Web Access by Time Using Squid Proxy Server

Next Article
List Services with systemctl on Linux

How to List Services with systemctl on Linux

Related Posts