Sunday, October 14, 2018

Ubuntu 18.04 Won't Resolve DNS

DNS Resolution Failure and Fix

I noticed after doing both fresh installations and upgrades of Ubuntu Server 18.04, DNS was either really slow, or it would not resolve at all. The symptoms were random. I searched high and low on the Internet. It took me a long time to find a solution.

By default, when installing Ubuntu, it will create a symbolic link from /etc/resolv.conf to /run/systemd/resolve/stub-resolv.conf. If DNS resolutions are failing, one solution is to remap this link. Point it to to /run/systemd/resolve/resolv.conf instead.  The following commands will move the link:

sudo rm /etc/resolv.conf
sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf

If you are experiencing long delays while performing DNS lookups, the previous commands should resolve the issue. To see what file your symbolic link is pointing to, run the following command.

ls -al /etc/resolv.conf

If it points to /run/systemd/resolve/resolve.conf then it should work just fine.

No comments:

Post a Comment