Container not getting an IPv4 address

Hi,

I am just starting to learn LXD. I installed and init LXD on my Ubuntu 22.04 laptop. Create a Ubuntu container. For some reason I dont get a IPV4 address for the container. Can someone help to identify the issue. I research the forums and discussions none of the solutions worked for me.

Thank you.

@ndevadas it’s hard to make a guess as to what could cause your instance to not get an IPv4 but we’ve often seen Docker and other tools adding firewall rules that would cause such issue. Please refer to https://documentation.ubuntu.com/lxd/en/latest/howto/network_bridge_firewalld/#prevent-connectivity-issues-with-lxd-and-docker for further instructions.

I followed the instructions. Removed docker and docker-compose from my laptop. added net.ipv4.conf.all.forwarding=1 to 99-sysctl.conf
. rebooted and still not getting ipv4 address. Thank you.

Did you check ufw from that same page?

https://documentation.ubuntu.com/lxd/en/latest/howto/network_bridge_firewalld/#ufw-add-rules-for-the-bridge

Yes. see bellow.

I am using networkmanager for connecting my laptop to internet using a wired connection.

ndevadas@in-info-1007884:~$ sudo ufw status
Status: active

To Action From


Nginx HTTP ALLOW Anywhere
Anywhere on lxdbr0 ALLOW Anywhere
67/udp on lxdbr0 ALLOW Anywhere
547/udp on lxdbr0 ALLOW Anywhere
53 on lxdbr0 ALLOW Anywhere
Nginx HTTP (v6) ALLOW Anywhere (v6)
Anywhere (v6) on lxdbr0 ALLOW Anywhere (v6)
67/udp (v6) on lxdbr0 ALLOW Anywhere (v6)
547/udp (v6) on lxdbr0 ALLOW Anywhere (v6)
53 (v6) on lxdbr0 ALLOW Anywhere (v6)

Anywhere ALLOW OUT Anywhere on lxdbr0
Anywhere (v6) ALLOW OUT Anywhere (v6) on lxdbr0

Anywhere ALLOW FWD Anywhere on lxdbr0
Anywhere on lxdbr0 ALLOW FWD Anywhere
Anywhere ALLOW FWD 10.18.125.0/24 on lxdbr0
Anywhere (v6) ALLOW FWD Anywhere (v6) on lxdbr0
Anywhere (v6) on lxdbr0 ALLOW FWD Anywhere (v6)
Anywhere (v6) ALLOW FWD fd42:e18c:7940:e3d0::/64 on lxdbr0

Following sequence of command worked for me.

lxc network set lxdbr0 ipv6.firewall false
lxc network set lxdbr0 ipv4.firewall false

sudo apt install firewalld

sudo firewall-cmd --zone=trusted --change-interface=lxdbr0 --permanent
sudo firewall-cmd --reload

Thank you.

1 Like