How to set permanent DNS nameservers on Ubuntu 21.04
To Set Permanent DNS Nameservers on Ubuntu 21.04
Introduction
DNS stands for Domain Name System server, which is responsible for translating a domain name into an IP address. Using custom DNS servers on Linux can improve performance and security.
Installation Procedure:
Step 1: Check the OS version by using the following command
root@linuxhelp:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 21.04
Release: 21.04
Codename: hirsute
Step 2: Install the resolvconf package by using the following command
root@linuxhelp:~# apt install resolvconf
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
resolvconf
0 upgraded, 1 newly installed, 0 to remove and 263 not upgraded.
Need to get 54.7 kB of archives.
After this operation, 203 kB of additional disk space will be used.
Get:1 http://in.archive.ubuntu.com/ubuntu hirsute/universe amd64 resolvconf all 1.84ubuntu1 [54.7 kB]
Fetched 54.7 kB in 6s (9,526 B/s)
Preconfiguring packages ...
Selecting previously unselected package resolvconf.
(Reading database ... 151399 files and directories currently installed.)
Preparing to unpack .../resolvconf_1.84ubuntu1_all.deb ...
Unpacking resolvconf (1.84ubuntu1) ...
Setting up resolvconf (1.84ubuntu1) ...
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.
Created symlink /etc/systemd/system/systemd-resolved.service.wants/resolvconf-pull-resolved.service → /lib/systemd/system/resolvconf-pull-resolved.service.
Processing triggers for man-db (2.9.4-2) ...
Processing triggers for resolvconf (1.84ubuntu1) ...
Step 3: Start the resolvconf service by using the following command
root@linuxhelp:~# systemctl start resolvconf.service
Step 4: Enable the resolvconf service by using the following 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 resolvconf service
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 2021-10-30 22:53:19 IST; 1min 55s ago
Docs: man:resolvconf(8)
Main PID: 6298 (code=exited, status=0/SUCCESS)
Tasks: 0 (limit: 2257)
Memory: 0B
CGroup: /system.slice/resolvconf.service
Oct 30 22:53:19 linuxhelp systemd[1]: Started Nameserver information manager.
Oct 30 22:53:19 linuxhelp resolvconf[6303]: /etc/resolvconf/update.d/libc: Warning: /etc/resolv.conf is not>
Step 6: Enter the nameservers in the resolv.conf.d by using the following command
root@linuxhelp:~# nano /etc/resolvconf/resolv.conf.d/head
Step 7: Update the resolvconf by using the following command
root@linuxhelp:~# resolvconf -u
Step 8: Check the nameserver entry reflected in resolv.conf
root@linuxhelp:~# nano /etc/resolv.conf
By this How to set permanent DNS nameservers on Ubuntu 21.04 comes to end
configure the system's DNS resolver