LXD Containers stopped resolving

I use containers for a Webserver with Haproxy in front of them on another container. Everything has run quite smoothly for some months. Sites work ok.

But containers are not able to resolve apt & yum repositories.

Anyone have some suggestions how I begin to troubleshoot this?


When you use HAProxy in a LXD setup, you can either put HAProxy on the host, or in a container. Tell us which type did you choose?

You would normally setup the containers to use managed networking (lxdbr0 default private bridge). Tell us if you used such a networking setup or you used something else.

There is a hardcore setup where you configure the containers not to have any networking. But I do not think you have used that.

Hi Simos,

I’ve actually followed some of your guides in the process. :grinning:
I always find your blog posts and Articles around the web insigtfull.

I’ve setup
host (forward all traffic on port 80 and 443 to haproxy container)
haproxy (container)
webserver (container)

I used the following command to forward traffic with iptables
sudo iptables -t nat -I PREROUTING -i INTERFACE_NAME -p TCP -d
PUBLIC_IP_ADDRESS/32 –dport 80 -j DNAT –to-destination HAPROXY_IP_ADRESS:80

–dport 443 -j DNAT –to-destination HAPROXY_IP_ADRESS:443

Other than that I have ZFS configured as the filesystem. The LXD network routing config is standard as installed. So I’ve not changed anything here after install.


With such a setup, the individual containers should still be able to get access to the Internet.
That is, the haproxy setup and the iptables rules should not affect in any way the networking of the individual containers.
The only thing I can think of, is if you setup ufw on the host and somehow it blocks DNS for the containers.

Run the following to see the full list of iptables rules on the host.

sudo iptables -L 
sudo iptables -t nat -L

Also, check that the containers that cannot resolve, do have an IP address. Because if you do not have IP addresses either, then they did not get their DHCP configuration from LXD at all.

@simos Thanks for the advice. The issue was a Network issue outside of the VPS I’m using (hosts network).

Been scratching my head about this one.

Bumped into the same issue after reloading the instance with a fresh OS. Using a different instance solved the issue.

Hosting Provider now scratching their heads :wink:

Thanks for your help.

Network issues seem resolved IPV6 was not going through their firewalls.

I’m unable to resolve the dns name of a container on a 2 brand new installs of LXD with Snap packages on Ubuntu 20.04.

On the one VPS it worked for a bit and then stopped.

Found this working through it: LXD using container hostnames