How to set permanent DNS Nameserver on Linux Mint 20.2

To Set Permanent DNS On Linux Mint 20.2

Introduction:

The Domain Name System is the hierarchical and decentralized naming system used to identify computers, services, and other resources reachable through the internet or other internet protocol networks. The resource records contained in the DNS associate domain names with other forms of information.

Installation Procedure:

Step 1: Check the OS version by using the below command

root@linuxhelp:~# lsb_release -a
No LSB modules are available.
Distributor ID:	Linuxmint
Description:	Linux Mint 20.2
Release:	20.2
Codename:	uma

Step 2: Install the resolvconf package by using the below command

root@linuxhelp:~# apt install resolvconf
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  resolvconf
0 upgraded, 1 newly installed, 0 to remove and 56 not upgraded.
Need to get 54.7 kB of archives.
After this operation, 200 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal/universe amd64 resolvconf all 1.82 [54.7 kB]
Fetched 54.7 kB in 1s (61.1 kB/s)     
Preconfiguring packages ...
Selecting previously unselected package resolvconf.
(Reading database ... 288936 files and directories currently installed.)
Preparing to unpack .../resolvconf_1.82_all.deb ...
Unpacking resolvconf (1.82) ...
Setting up resolvconf (1.82) ...
Created symlink /etc/systemd/system/sysinit.target.wants/resolvconf.service → /lib/systemd/system/resolvconf.service.


Created symlink /etc/systemd/system/systemd-resolved.service.wants/resolvconf-pull-resolved.path → /lib/systemd/system/resolvconf-pull-resolved.path.
resolvconf-pull-resolved.service is a disabled or a static unit, not starting it.
Processing triggers for systemd (245.4-4ubuntu3.13) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for resolvconf (1.82) ...

Step 3: Start the resolvconf.sevice by using the below command

root@linuxhelp:~# systemctl start resolvconf.service

Step 4: Enable the service by using the below command

root@linuxhelp:~# systemctl enable resolvconf.service
Synchronizing state of resolvconf.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable resolvconf

Step 5: Check the status of the service by using the below command

root@linuxhelp:~# systemctl status resolvconf.service
● resolvconf.service - Nameserver information manager
     Loaded: loaded (/lib/systemd/system/resolvconf.service; enabled; vendor preset: enabled)
     Active: active (exited) since Sat 2022-01-08 02:49:03 IST; 1min 21s ago
       Docs: man:resolvconf(8)
   Main PID: 76440 (code=exited, status=0/SUCCESS)
      Tasks: 0 (limit: 4579)
     Memory: 0B
     CGroup: /system.slice/resolvconf.service

Jan 08 02:49:03 linuxhelp systemd[1]: Started Nameserver information manager.
Jan 08 02:49:03 linuxhelp resolvconf[76445]: /etc/resolvconf/update.d/libc: Warning: /etc/resolv.conf is not a symbolic link to /run/>

Step 6: Enter the permanent DNS nameserver configuration by using the below command

root@linuxhelp:~# nano /etc/resolvconf/resolv.conf.d/head
  GNU nano 4.8                                      /etc/resolvconf/resolv.conf.d/head                                                
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

128.127.0.0.53 is the systemd-resolved stub resolver.

run "systemd-resolve --status" to see details about the actual nameservers.
nameserver 8.8.8.8
nameserver 8.8.4.4

Step 7: Update the Configuration by using the below command

root@linuxhelp:~# resolvconf -u

Step 8: Check whether it is edited or not by using the below command

root@linuxhelp:~# nano /etc/resolv.conf 
  GNU nano 4.8                                               /etc/resolv.conf                                                         
Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)

O NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN

127.0.0.53 is the systemd-resolved stub resolver.

run "systemd-resolve --status" to see details about the actual nameservers.
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 127.0.0.53
options edns0 trust-ad

Conclusion:

We have reached the end of this article. In this guide, we have walked you through the steps required to Set Permanent DNS On Linux Mint 20.2. Your feedback is much welcome.

FAQ
Q
How to Find My DNS Server IP Address?
A
We can find DNS Server IP Address by using the following command "cat /etc/resolv.conf"
Q
How will you update the reslovconf package?
A
By using the resolvconf -u command we can easily update
Q
What is the directory path to add the name server?
A
By giving this path /etc/resolvconf/resolv.conf.d/head we can add the name server in that file.
Q
What is the command line to enable the resolvconf service?
A
By using the systemctl enable resolvconf.service we an enable the service.
Q
How can we install the DNS package?
A
By using the apt install resolvconf command we can install it.