Bridge gets MAC address of most recently started container

Hi,

Here is a weird thing that just found out. I have a bridge, br0, that I have created outside LXD. This bridge contains the physical ethernet port, e.g eno1.
I’m using that bridge in a profile called default_pub. That profile is a copy of default, except that it uses br0 instead of lxdbr0.
All is fine and dandy. I can create containers that appear on my local network.
Before any container is started br0 has the MAC address of eno1. But when a container is started the bridge gets the MAC address of that container.

Is this normal for bridges? Maybe it is, but I’m quite surprised by it. Because on a new system I configured the bridge to get an IP address through DHCP. That system really gets confused when containers are started and stopped.

In the meantime I found something that could explain the things I’m seeing.

Yea its normal, but if you set the bridge manually (or via your oses network settings) it won’t change.

FYI The bridge is created through netplan / networkd.

$ cat /etc/netplan/00-installer-config.yaml
network:
  version: 2
  renderer: networkd
  ethernets:
    eno1:
      dhcp4: false
      dhcp6: false
  bridges:
    br0:
      interfaces: [eno1]
      addresses:
      - 192.168.1.35/24
      gateway4: 192.168.1.1
      nameservers:
        addresses:
        - 192.168.1.1
        search:
        - example.com

That is apparently not enough to get a fixed MAC address, because br0 had the MAC address of one of the containers.
So, now I added macaddress to br0, copied from eno1.

1 Like