LXD/LXC containers not getting IP from lxdbr0

I have installed lxd by using snap package in debian 10 buster. My host computer is connected via a LAN cable. I tried to use the default profile. But, my container does’t get any ipv4 from the “lxdbr0”.

From my container I see It uses the default profile

root@debian:~# lxc info debian-10
Name: debian-10
Location: none
Remote: unix://
Architecture: x86_64
Created: 2020/11/01 20:12 UTC
Status: Running
Type: container
Profiles: default
Pid: 9180
Ips:
  lo:	inet	127.0.0.1
  lo:	inet6	::1
  eth0:	inet6	fd42:67b:89ca:313e:216:3eff:fe44:a847	veth2214a7cc
  eth0:	inet6	fe80::216:3eff:fe44:a847	veth2214a7cc

Default profile

root@debian:~# lxc profile show default
config: {}
description: Default LXD profile
devices:
eth0:
name: eth0
network: lxdbr0
type: nic
root:
path: /
pool: default
type: disk
name: default
used_by:

  • /1.0/instances/debian-10

My default profile uses the bridge(“lxdbr0”) which was created during lxd init
I tried different things e.g

  • lxc stop debian-10
  • lxc network attach lxdbr0 debian-10 eth0 eth0
  • lxc config device set debian-10 eth0 ipv4.address 10.153.186.10
  • lxc start debian-10

I also tried to set manually (address, netmask etc)in my container /etc/network/interfaces to fix an ip

  • auto eth0
  • iface eth0 inet static
  • address 10.153.186.10
  • netmask ..**.
  • gateway ...**

Unfortunately, nothing workout for me. Does anybody help me to figure out what I am doing wrong.?Thanks in advance.

Check that you don’t have Docker installed on the host, it likes to mess with networking, preventing other containers/vms from working.

If that’s not it, check that you don’t have firewalling in place on the host which would similarly prevent LXD networking from working.

If that’s still not it, check that dnsmasq is running on lxdbr0, if that’s not the case, look for conflicting DNS/DHCP server on the system.

Going to add some more info, for the record.

For me, having docker running at the same time was no problem.

This solved it for me! ufw was blocking dhcp requests. The solution was:

sudo ufw allow in on lxcbr0

source: Archwiki: Linux containers#Firewall considerations

You can check this with:

sudo ps awux | grep dnsmasq

source: Github: canonical/lxd#1298

Yes, there are similar recommendations here

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