PiHole via Docker Ubuntu port forwarding port 53 taken [solved]

Ubuntu 19.10, clean install not messed around. I use Docker and would like to install PiHole via Docker Compose.

However on Ubuntu systemd-resolve uses port 53 by default.
That port needs to be available for port binding for PiHole. To solve this:
sudo nano /etc/systemd/resolved.conf

Uncomment and change to no (everything is commented out by default):

DNSStubListener=no

Restart the service.

Expected Behaviour:

sudo lsof -i -P -n | grep 53 should show the port is not in use anymore: CORRECT
But internet should still work.

Actual Behaviour:

Now I cannot surf the internet anymore. Undoing the change solves this issue, but port 53 is in use again.

How do others overcome this issue?

I found a solution but I am unsure if this will break anything else:

This is what I did:
sudo nano /etc/systemd/resolved.conf

[Resolve]
DNS=192.168.88.1   #uncommented & my routerip
#FallbackDNS=
Domains=lan             #uncommented & lan
#LLMNR=no
#MulticastDNS=no
#DNSSEC=no
#DNSOverTLS=no
Cache=no                  #uncommented
DNSStubListener=no #uncommented
#ReadEtcHosts=yes

sudo systemctl restart systemd-resolved

Now I see port 53 is available and I can install Pihole via Docker!
BUT it seems this messes with /etc/resolv.conf as well. By default:

GNU nano 4.3                                                                                    
# Generated by NetworkManager
nameserver 127.0.0.53

But now it contains (note I didn't do this, this happened by itself)

nameserver 192.168.88.1
nameserver 37.143.84.228
nameserver 37.143.84.229
search lan

That first nameserver = my router IP
the 2nd and 3rd are the 2nd and 3rd DNS providers (fallback) shown in my router.

Is this a safe solution?

Did you follow Pi-hole's official guide for Docker tips when installing on Ubuntu?

1 Like

Yes, as mentioned I do not have internet access anymore in my browser when I do that. Perhaps it worked for older versions of Ubuntu. I am on 19.10.

I also found this:

It seems macvlan is the only way to get this working correctly. But I haven't gotten that working yet, the example of lawrence leads to an error about wrong subnet, even though I defined the correct subnet my router provides.

Tony Lawrence has a good writeup on using macvlan for synology. I adopted and revised the docker-compose.yaml file - see my [writeup](Tony Lawrence has a good writeup on using macvlan for synology. I adopted and revised the docker-compose.yaml file - see my writeup here and the example docker-compose.yaml file you can download. Just edit to put in your own network configuration and you will be up and running in not time. Works flawlessly and allows you to have an ip address separate from your pi-hole. Just be aware of the macvlan bug on 4.19.7 raspbian kernel that I mention in my post. Just edit the example docker-compose.yaml to put in your own network configuration and you will be up and running in not time. Works flawlessly and allows you to have an ip address separate from your pi-hole. Just be aware of the macvlan bug on 4.19.7 raspbian kernel that I mention in my post. Guide on Using Macvlan with PI-hole: https://geekvisit.com/pi-hole/).

yup I used his example. This is what I did and it worked perfectly. You can find my example here: Homeserver/pihole_docker-compose.yml at 53ed1a13c7a1613a95ae927d0aa38803e57a38cb · zilexa/Homeserver · GitHub

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.