Fix Ubuntu Server Name Resolution when Pi-Hole is Installed

Fix Ubuntu Server Name Resolution when Pi-Hole is Installed

When installing a Pi-Hole on an Ubuntu server I found that once install the Ubuntu server itself was no longer able to resolve DNS.

I wasn’t sure how to resolve this until I was researching LAN Cache and they highlight a similar issue and how to “resolve” it.

This issue definitely effects Pi-Hole docker container but unsure if also effects standard install.

Below is the fix from lancache.net for reference

Disabling systemd-resolved DNSStubListener

If your cache host is running a recent Linux distribution, it is likely running systemd-resolved, which listens on port 53. If you want your cache host to bind to 0.0.0.0:53 (INADDR_ANY, all IPv4 addresses), you will first need to disable systemd-resolved’s stub listener.

  1. Run sudo -e /etc/systemd/resolved.conf and change the line starting with #DNSStubListener= to DNSStubListener=no – removing the # is important
  2. Run sudo rm /etc/resolv.conf
  3. Run sudo ln -s /var/run/systemd/resolve/resolv.conf /etc/resolv.conf
  4. Run sudo service systemd-resolved restart
  5. Check that you can still resolve DNS on the cache server by running nslookup for a domain of your choice (e.g. lancache.net)