After upgrade to Xubuntu 22.04, containers no longer get IPv4 addresses

I upgraded to Xubuntu 22.04 and now containers are no longer getting IPv4 addresses. Apparently, dnsmasq is running and IPv6 is working. The containers are unchanged, only the host was upgraded.

lxc --version

On the containers, using ip -a will show the containers have an IPv6 address, but no IPv4.

I’m not sure what other informations would be required to investigate this issue.

22.04 hasn’t been released yet so I’m a bit confused as to what you’re actually running :slight_smile:

What you’re describing could be one of two things:

  • Firewalling blocking access, this can be caused by Docker being installed on the host and blocking other container managers (quite common) or something like ufw/firewalld getting in the way
  • You running a system that’s cgroup2 enabled with containers which do not support it (like Ubuntu 16.04, CentOS 7, …)
1 Like

I’m using the development branch of 22.04. Docker is not installed, but disabling ufw allowed the containers to get the IPv4 addresses. Strangely, dmesg shows no UFW block.

This could well be because ufw is using nftables (natively or via iptables) and blocking LXD’s networking.


Hey just adding my 2cents to this thread - and this is slightly off-topic because it pertains to Jammy containers not Jammy host - but its relevant I guess.

Today in the early afternoon, my Ubuntu Jammy 22.04 LXD DNS-DHCP container suddenly stopped getting DHCP ipv4 addresses (it had been working fine prior to the actual production release of Jammy, so maybe something happened when they rolled out Jammy GA - or maybe it is related to this New containers not getting ipv4 address (broken base images).

I tried the ufw steps that were suggested to get DHCP working inside Jammy containers, but it didn’t fix.

Then I took a look at /etc/netplan inside the Jammy container, and found the /etc/netplan directory for the vanilla just-installed jammy lxc container was totally empty. I did the following steps which fixed Ipv4 DHCP:

cd /etc/netplan

sudo vi 10-dhcp.yaml

  version: 2
  renderer: networkd
      dhcp4: true
      dhcp6: false

sudo netplan apply

And now ipv4 DHCP is working perfectly inside the LXD Jammy container.

Also, I guess I will mention a slight tangent to this topic, but related: If you happen to end up using a netplan that uses the “gateway4” setting, note that “gateway4” syntax has been deprecated and has been replaced with new syntax as shown below:


replace with this syntax:

    - to: default

That is because of New containers not getting ipv4 address (broken base images) and is temporary