Browse Source

systemd: Work around new systemd persistent MAC "feature"

  With the systemd version in Debian Bullseye systemd-udevd will by default
  change MAC addresses of interfaces with a random MAC (bridges, veth, tun/tap,
  etc.) to a persistent MAC based on the machine-id as well as the interface
  name.  As a consequence bridges will not get the MAC address of the first
  interfaces added anymore.  This commit restores the old behaviour to ensure
  nothing will break unexpectedly down the line.

  See https://github.com/systemd/systemd/issues/21185 for more context.

Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
Maximilian Wilhelm 2 years ago
parent
commit
1c6d5423bd
2 changed files with 23 additions and 0 deletions
  1. 11 0
      systemd/90-unfuck-mac-overwrite.link
  2. 12 0
      systemd/init.sls

+ 11 - 0
systemd/90-unfuck-mac-overwrite.link

@@ -0,0 +1,11 @@
+#
+# Overwrite MACAddressPolicy=persistent which is set in defautl config file
+#  /lib/systemd/network/99-default.link  so systemd-udevd will NOT fiddle
+# around with interfaces it has no businss in touching at all.
+#
+
+[Match]
+OriginalName=*
+
+[Link]
+MACAddressPolicy=none

+ 12 - 0
systemd/init.sls

@@ -29,3 +29,15 @@ wait-for-routes.service:
   file.managed:
    - source: salt://systemd/wait-for-routes
    - mode: 755
+
+
+#
+# Unfuck systemd defaults likely to break stuff
+#
+{% if grains.oscodename == "bullseye" %}
+/etc/systemd/network/90-unfuck-mac-overwrite.link:
+  file.managed:
+    - source: salt://systemd/90-unfuck-mac-overwrite.link
+    - watch_in:
+      - cmd: systemctl-daemon-reload
+{% endif %}