> We set the address before udev gets to the networking rules, so udev
sees /sys/devices/virtual/net/docker0/addr_assign_type = 3
(NET_ADDR_SET). This means there's no need to assign a different
address and everything is fine.
This got me thinking that if we can set the MAC address at the same time the interface is created (in one operation) then this might prevent systemd-udevd from thinking it needs to generate and apply a persistent MAC address.
I've figured out how to update LXD's use of `ip link add` command to apply the MAC, MTU, and other settings directly in a single execution rather than calling `ip link add` first to create the veth pairs, and then subsequently calling `ip link set` afterwards.
Hopefully this should be sufficient to ensure that systemd-udevd always sees the veth interfaces created by LXD as having a manually set MAC address and will leave them alone.
I've been looking into this today and have come across some relevant links which I suspect explain the issue.
I suspect it is the change to systemd-networkd that adds a default link policy of:
`MACAddressPoli cy=persistent`
Which would apply to new veth interfaces created.
See:
https:/ /bugzilla. suse.com/ show_bug. cgi?id= 1136600 /github. com/systemd/ systemd/ issues/ 25555 /gitlab. freedesktop. org/NetworkMana ger/NetworkMana ger/-/merge_ requests/ 15#note_ 162509 /github. com/moby/ libnetwork/ pull/2380
https:/
https:/
https:/
Specifically the last one was key:
> We set the address before udev gets to the networking rules, so udev virtual/ net/docker0/ addr_assign_ type = 3
sees /sys/devices/
(NET_ADDR_SET). This means there's no need to assign a different
address and everything is fine.
This got me thinking that if we can set the MAC address at the same time the interface is created (in one operation) then this might prevent systemd-udevd from thinking it needs to generate and apply a persistent MAC address.
I've figured out how to update LXD's use of `ip link add` command to apply the MAC, MTU, and other settings directly in a single execution rather than calling `ip link add` first to create the veth pairs, and then subsequently calling `ip link set` afterwards.
Hopefully this should be sufficient to ensure that systemd-udevd always sees the veth interfaces created by LXD as having a manually set MAC address and will leave them alone.
https:/ /github. com/lxc/ lxd/pull/ 11399