Update: What to do if port 53 is already in use

This is an update to this Post
When the Port 53 is already in Use, you can check this with this command (ubuntu):

Port 53 is being used at your host machine, that's why you can not bind 53 to host.

To find what is using port 53 you can do: sudo lsof -i -P -n | grep LISTEN

I'm a 99.9% sure that systemd-resolved is what is listening to port 53.

To solve that you need to edit the /etc/systemd/resolved.conf and uncomment DNSStubListener and change it to no, so it looks like this: DNSStubListener=no

After that reboot your system or restart the service with service systemd-resolved restart

3 Likes

For a specific time I also used #5353 as described here in th kuketz-blog.

The port is setup here
sudo nano /etc/unbound/unbound.conf.d/pi-hole.conf
and in the pihole admin view.

I don't know if this is a typo in this docu but it worked properly in my case.

We do not recommend 5353 for unbound anymore because the port is used by mDNS

You can use any other unused port. In our guide we've choosen 5335.

1 Like

How can i do this on fedora

Rando from the future: I am trying to find out what to do when this fails to work. For context, I am trying to run pihole locally on a docker container on my ubuntu desktop and have just my desktop use it for DNS.

I've tried addding DNSStubListener=no to /etc/systemd/resolved.conf and restarting the resolve service with sudo systemctl restart systemd-resolved.service . Every time I try and run docker compose up -d against the standard pihole setup (changed password and timezone accordingly) I get the following classic error

failed to bind port 0.0.0.0:53/tcp: Error starting userland proxy: listen tcp4 0.0.0.0:53: bind: address already in use

Any idea what's up? Running sudo lsof -i -P -n | grep LISTEN shows dnsmasq running:

dnsmasq 2616 dnsmasq 7u IPv4 15242 0t0 TCP 10.0.3.1:53 (LISTEN)

I am assuming that's a part of systemd-resolved but that could be a bad assumption.