Ubuntu: After each reboot cannot resolve host by Dns



Question:

After each reboot Ubuntu cannot resolve host by DNS and cannot open any page. I use to run these commands after each reboot to make everything work

rm /etc/resolv.conf   sudo ln -s /run/resolvconf/resolv.conf /etc/resolv.conf  sudo resolvconf -u  

How can I avoid that issue?


Solution:1

I see that you're already trying to use the solution described here: https://unix.stackexchange.com/questions/280264/no-dns-resolution-after-upgrade-from-ubuntu-14-04-to-16-04

While not ideal, a work-around would be to automatically run your commands on boot. This page includes some methods of doing that:

http://linuxtechlab.com/executing-commands-scripts-at-reboot/

Another possibility is that you're affected by the bug in the March 2017 update:

https://www.digitalocean.com/community/questions/how-to-fix-the-march-2017-ubuntu-dns-resolution-issues

Another very thorough answer appears here: 16.10 fail to resolve DNS

I don't know enough about your precise circumstances to advise a particular one of these to try first, but hopefully one of them will work for you.

Update: Based on the knowledge that it's failing when the server reboots with a non-standard VPN client up, it's reasonable to assume that this VPN client could be modifying resolv.conf and removing some of the default entries in an attempt to avoid DNS leakage. I would recommend then making sure that your VPN client is disconnected before shutdown, and possibly still automatically resetting the resolv.conf after boot.

Alternatively, you could try adding a legitimate nameserver of your choice, such as nameserver 8.8.8.8 to the file /etc/resolvconf/resolv.conf.d/head, which might help. I am not sure if this will affect functionality of your VPN or not, or cause DNS leaking, so use it cautiously. Source:
https://ubuntuforums.org/showthread.php?t=2352821&page=2


Solution:2

It sounds like something (perhaps your PulseSecure client) is overwriting /etc/resolv.conf or /run/resolvconf/resolv.conf the latter by default should contain the following:

# 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  nameserver 127.0.1.1  

the former as you know is supposed to be a symbolic link to the latter. You might check these files prior to reboot to insure they are unchanged. or better yet watch them for changes to determine when and why the modification occurs.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »