I am trying to have an authoritative only Bind server inside a LXC container but when I went to forward the port 53 to it, I received an error saying the port is already in use. (listen=tcp: connect=tcp:

After researching I understood that dnsmasq/netplan/systemd-resolve (don't really know which one) is responsible for the container name resolution.

systemd-r  608 systemd-resolve   13u  IPv4  21646      0t0  TCP localhost:domain (LISTEN)    
dnsmasq   6667             lxd    9u  IPv4 103653      0t0  TCP v2202102:domain (LISTEN)    
dnsmasq   6667             lxd   11u  IPv6 103655      0t0  TCP v2202102:domain (LISTEN)

Does anyone have any idea on what I could do to solve this? I thought about the following:

  • Disabling dnsmasq but then I won't get the name resolution from the containers anymore...

  • Disabling dnsmasq and let Bind resolve the names - No clue on how to do that..

  • Changing dnsmasq port - I have no clue on how to do that and ensure the container resolution keeps working

  • Other ideas are welcome :)

I am using Ubuntu 20.04 with LXD 4.xxx

Thanks in advance.


Thank you for the help! Bind forwarding to dnsmasq looks to me the ideal approach but unfortunately I couldn't find the dnsmasq configuration file and when using systemctl status dnsmasq it says it isn't installed LOL... quite weird if you ask me.

I ended up with a less intrusive approach, which is listening just to my external_IP_address:53 instead of the whole as I was trying before.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.