DNS query not working in Containers


I have a Nocix Server with 5 ip’s. I’ve installed Xen to run a Windows VM, with a network bridge called xenbr0. Now I also did install LXD for having Linux containers, and I did instruct LXD to use xenbr0 as network interface. In the containers (ubuntu & centos) I did configure a static ip from the IP’s I can assign. Network access is working, I’m able to do ping correctly, but not ping www.google.com. /etc/network/interfaces and resolv.conf show the correct DNS servers, and I’m also able to reach the servers over ping. Why does DNS access not work? Firewall is disabled, so this also cannot be the problem. There are a lot of instructions on the net how to confiugre DHCP in the containers, but I want to configure static ip’s for the containers.

Which resolver is being utilized and where in the setup? Could there be a conflict of 2 resolvers listening on DNS port (53?) or a conflict of routing DNS queries?

Not sure how it works with LXD but with LXC you can assign static container ips via /etc/lxc/dnsmasq.conf, that if dnsmasq is utilized on the container host.

If you have static IP, you need to deal with the DNS settings yourself. LXD does not autoconfigure the DNS server for you.

Is this LXD specific? In LXC I got static container ips set in /etc/lxc/dnsmasq.conf and the containers’ DNS server are set to the host’s ip automatically - that is if dnsmasq is handling the LXC networking on the host.

In that case, your dnsmasq has been serving the network configuration using DHCP to the container, therefore it was a case of dynamic IP.
Static IP is when the container sets the network configuration without external help.

That case could be described as dynamic IP using fixed IP address.

1 Like