Disable systemd stub resolver on Ubuntu

By hernil

Ever had trouble listening to port 53 on an Ubuntu installation? It is due to systemd having it’s own internal resolver doing some caching Fine, but here is how I disable it.1

sudo sed -r -i.orig 's/#?DNSStubListener=yes/DNSStubListener=no/g' /etc/systemd/resolved.conf && \
sudo sh -c 'rm /etc/resolv.conf && ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf' && \
sudo systemctl restart systemd-resolved

Now feel free to claim port 53 for Pihole, Technitium or whatever other DNS server you want listening to port 53.


  1. Initially inspired by some Pihole docs↩︎


Input or feedback to this content? Reply via email!
Related Articles