Debian lxd 4 port 53 issues

Hi all.

When I run lxd init and enable the default bridge, lxd spins up its own dnsmasq to assign ip’s to the containers, thus taking over port 53. Which means you cannot use 53 for anything else.

My intention is to run PiHole in the container and forward all dns traffic from the host to it.

I know how to proxy the port from the host to the container, that is not the problem.

The problem is that I cannot do anything with port 53 in the host because lxd has it.

Is there a way to disable the dhcp service in lxd (I am happy to assign IP’s manually to containers), or make lxd’s dnsmasq use a different port, or just go away and give me back my dns port?

Thanks all. I have been searching the internet for hours with no joy.

Debian 11 Bullseye with lxd 4 from snapd (dunno what other info is useful).

LXD does not take port 53 entirely. It binds port 53 only on the bridge it creates (usually called lxdbr0).
The reason you may be seeing conflicts is that your application is likely trying to bind to port 53 on the wildcard address (meaning its trying to listen on all interfaces).

So the easiest fix may be to change the application that is conflicting to not listen on all interfaces but instead listen on specific addresses.

If that is not possible then you can disable LXD’s dnsmasq’s DNS listener entirely using:

lxc network set lxdbr0 raw.dnsmasq="port=0"

This will disable DNS in the instances if they are using DHCP as they will try and query the lxdbr0 IP.

If you want to use DHCP from LXD but specify a different DNS server address in the DHCP responses you can do:

lxc network set lxdbr0 raw.dnsmasq=$'port=0\ndhcp-option=option:dns-server,x.x.x.x'

Where x.x.x.x is the DNS server you want to use.

1 Like

thanx

1 Like