I have switched my containers to use lxdbr0, created a new subnet for my containers and I am reaching the containers from LAN thanks to port forwarding:
I’m very happy with this setup but I bumped into an issue when trying to get the DNS container to work ( using AdGuard Home as DNS ). When I try to do port forwarding for port 53, I get an error saying that address is already in use.
I can see that dnsmasq is using port 53 by user lxd
I also found a this on this forum which seems to help me but it is a bit overwhelming and I would like to see if there is an “lxd way” to forward port 53.
I’m kinda at a loss here, not sure what is happening. I kindly ask for someone to guide me on how to forward port 53 from host to one of my containers running a dns service.
LXD provides a DHCP and DNS server listening on the lxdbr0 interface in the form of dnsmasq.
So this listens on port 53 of the lxdbr0 interface’s IP.
Your proxy device is being configured to listen on the wildcard address (0.0.0.0) on the host.
This means it will try and listen on all IPs on all interfaces of the host.
This will conflict with the LXD dnsmasq process as you have found.
You should change listen: tcp:0.0.0.0:<port> to the specific listen IP you want, which is probably the IP address of the LXD host’s external interface that connects to the wider LAN.
I made sure to have the right ports forwarded like so:
53:53/tcp ← listens on host IP
53:53/udp ← listens on host IP
784:784/udp ← listens on 0.0.0.0
853:853/tcp ← listens on 0.0.0.0
3000:3000/tcp ← listens on 0.0.0.0
80:80/tcp ← listens on 0.0.0.0
443:443/tcp ← listens on 0.0.0.0
Found it a bit weird though that it took some time for the whole thing to become stable, especially with my defined DNS rewrites. But after a coffee things look good, and hopefully they stay that way
On thing which I find suspicious and I would like to share is that when in my DNS container I do netstat -an | grep :53 I get loads and loads of ESTABLISHED upd activity.
root@net:~# netstat -an | grep :53
tcp6 0 0 :::53 :::* LISTEN
udp 0 0 127.0.0.1:46823 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:38632 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:34543 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:55032 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:46844 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:59133 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:50943 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:59148 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:34578 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:38676 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:34589 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:59170 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:34594 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:50979 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:34604 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:46903 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:42807 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:42809 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:34633 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:59218 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:51027 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:34644 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:42850 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:42854 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:46953 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:34665 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:46964 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:59252 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:55158 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:46975 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:59265 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:42890 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:42891 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:46998 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:46999 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:47008 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:55201 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:38833 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:51122 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:34742 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:59319 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:42938 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:59333 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:55241 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:38859 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:42958 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:55247 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:42965 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:51164 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:38877 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:42991 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:59378 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:59384 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:43002 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:38906 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:59392 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:43032 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:38937 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:51236 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:59430 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:38952 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:43057 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:38970 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:34875 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:47170 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:59459 127.0.0.1:53 ESTABLISHED
udp 0 0 127.0.0.1:59463 127.0.0.1:53 ESTABLISHED
...
And I’m not sure how to debug this, would appreciate any suggestions.
I just want to note that the same service works when the client is connected to VPN with no issues ( port forwarded 51820 as specified on my router too ) and also the same service worked when it was using a bridged network and had it’s own IP in my LAN
Hello @tomp! I have re installed the container from scratch and I don’t have the issue anymore. Hence I am assuming that, as you advised, listening to the specific host IP for my container port forward did the trick.
As to per your last question I have updated the DNS IPs like so
# Generated by NetworkManager
nameserver 192.168.1.158
nameserver 10.0.2.0
I removed the DNS IP provided by my ISP. 192.168.1.158 is the IP of my host running the DNS container and 10.0.2.0 that’s my WireGuard DNS IP and these are configured in my router.