Solved:DNS resolver issue in Ubuntu 18.04 and later. How to stop dns entry in /etc/resolve.conf from getting changed after reboot.
Earlier when we have DNS resolving issue, we open up /etc/resolv.conf file to add the dns entry and it works. Now with Ubuntu 18.04 and later, it doesn't. Every time we reboot the system, the dns entry gets changet to its default ip 127.0.0.53. So how do we stop the dns entry from getting changed to its default value. Please try the following steps:
Image below shows the default content of the /etc/resolv.conf file
1. First install the resolvconf package
#sudo apt-get install resolvconf
2. Open the file /etc/resolvconf/resolv.conf.d/head and add your nameservers detail
# 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
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.
nameserver 192.168.255.227
3. Now restart the resolvconf service
# sudo /etc/init.d/resolvconf restart
This should fix your issue. Now if you check the /etc/resolv.conf file you will see the dns entry as desired.
Image below shows the default content of the /etc/resolv.conf file
1. First install the resolvconf package
#sudo apt-get install resolvconf
2. Open the file /etc/resolvconf/resolv.conf.d/head and add your nameservers detail
# 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
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.
nameserver 192.168.255.227
# sudo /etc/init.d/resolvconf restart
This should fix your issue. Now if you check the /etc/resolv.conf file you will see the dns entry as desired.
Comments
Post a Comment