/etc/resolv.conf is the main configuration file for library resolver name DNS. Resolver is a set of functions in C library which provide access to Internet Domain Name System (DNS)
Why Edit the /etc/resolv.conf File?
The main reason is probably because the system DNS settings is wrongly configured or you prefer to use a specific name server or your own. The following command shows the default name server in the /etc/resolv.conf file on my Ubuntu system.
$ cat /etc/resolv.conf
HTML
Installing resolvconf in Ubuntu and Debian
- First, update the system software packages and then install the resolvconf of the official repository by carrying out the following commands.
$ sudo apt update $ sudo apt install resolvconfHTML - Once the resolvconf installation is completed, the systemd will trigger the resolvconf.service to start and be automatically activated. To check if it is already active and running, run the following command.
$ sudo systemctl status resolvconf.serviceHTML - If the service is not started and activated automatically for any reason, you can start and activate it as follows.
$ sudo systemctl start resolvconf.service $ sudo systemctl enable resolvconf.service $ sudo systemctl status resolvconf.serviceHTML - Click on New template and start creating your template
Set Permanent DNS Nameservers in Ubuntu and Debian
- Next, open the /etc/resolvconf/resolv.conf.d/head configuration file.
$ sudo vi /etc/resolvconf/resolv.conf.d/headHTML - and add the following lines in it:
nameserver 8.8.8.8 nameserver 8.8.4.4HTML - Save changes and start resolvconf.service or reboot the system.
$ sudo systemctl start resolvconf.serviceHTML
- Now when you check the /etc/resolv.conf file, the name server entry should be kept there permanently. For the next, you can also add your custom nameserver