Host OS: Ubuntu 20.04
LXD snap latest/stable
Container image: Ubuntu 22.04
Networking: lxbr0 LXD bridge
Since I’m not using cloud-init, I purged the cloud-init package, and since this container is for a very limited access research project, I disabled apparmor.
However, after doing this I notice that whenever I reboot or stop/start the container, it loses its IPv4 address:
lxd-user@kerkyra:~$ lxc list
+------------+---------+------+------+-----------+-----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
+------------+---------+------+------+-----------+-----------+
| ubuntu2204 | RUNNING | | | CONTAINER | 0 |
+------------+---------+------+------+-----------+-----------+
Re-running netplan apply
resolves the issue:
lxd-user@kerkyra:~$ lxc exec ubuntu2204 -- netplan apply
WARNING:root:Cannot call Open vSwitch: ovsdb-server.service is not running.
lxd-user@kerkyra:~$ lxc list
+------------+---------+----------------------+------+-----------+-----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
+------------+---------+----------------------+------+-----------+-----------+
| ubuntu2204 | RUNNING | 10.29.229.132 (eth0) | | CONTAINER | 0 |
+------------+---------+----------------------+------+-----------+-----------+
Can someone explain what is going on here? Also, generally I use a host system bridge to spin up containers as ordinary hosts on the network, in which case I assign static IP addresses to containers. Does it even make sense to set a static IP address for a container attached to lxbr0? I realized I don’t recall ever setting this up. A reference to any available documentation would also be helpful. I’m a bit confused right now about how networking is working.