How to Set permanent DNS nameservers on Ubuntu with resolv.conf
How to Set permanent DNS nameservers on Ubuntu with resolv.conf
With the default resolv.conf file in ubuntu the nameserver is mentioned as following "nameserver 127.0.0.53".
Resolv.conf file Ubuntu |
The Original DNS servers behind this can be found with "resolvectl status" command.
resolvectl status |
The problem with that , you fill face "Temporary name resolution failures" errors frequently. To Solve that we'll need to do the foloowing steps.
Solution:
Installing resolvconf package
Let’s install the resolvconf package. Enter the following code:
sudo apt update
sudo apt install resolvconf
To enable and start the resolvconf service, enter the following code:
sudo systemctl enable resolvconf.service
sudo systemctl start resolvconf.service
sudo systemctl status resolvconf.service
|
Set DNS servers in resolv.conf using head file
Now we get to the meat of this article. Let’s open the head file:
sudo nano /etc/resolvconf/resolv.conf.d/head
Enter your nameservers below the comments (I’m using Google’s DNS servers).
nameserver 192.168.0.1
nameserver 8.8.8.8
We need to update resolv.conf to use the new nameservers. Enter the following code:
sudo resolvconf --enable-updates
sudo resolvconf -u
No comments