Skip to content

Support us

Authors: fire1ce | Created: 2022-06-28 | Last update: 2024-02-26

Free Port 53 on Ubuntu

What's Using Port 53?

When you install Ubuntu (in my case its Server version). It uses systemd-resolved as internal DNS Forwarder.

systemd-resolved is a system service that provides network name resolution to local applications. It implements a caching and validating DNS/DNSSEC stub resolver, as well as an LLMNR resolver and responder.

Netstat output

How to Free Port 53 on Ubuntu

If we want to use port 53 for other purposes, we need to free it for example a Pihole DNS server.

We can do it with the following commands:

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