When I add the config files below into /etc/systemd/network
and restart systemd-networkd
, I find that the MAC addresses of bond0
, eth0
and eth2
have all been changed to a single, locally administered address. This breaks DHCP, and doesn't follow the expectation set by the Linux kernel bonding documentation that states that the bond interface will take the MAC address of one of its slaves.
According to the networkd documentation, the issue appears to be this:
MACAddress=
The MAC address to use for the device. For "tun" or "tap" devices, setting MACAddress= in the "[NetDev]" section is not supported. Please specify it in "[Link]" section of the corresponding systemd.network(5) file. If this option is not set, "vlan" devices inherit the MAC address of the physical interface. For other kind of netdevs, if this option is not set, then MAC address is generated based on the interface name and the machine-id(5).
(Emphasis mine.)
How do I prevent this MAC address generation and tell networkd to just use one from the slaves?
Files
10-bond0.netdev
[NetDev]
Name=bond0
Kind=bond
[Bond]
Mode=802.3ad
10-bond0.network
[Match]
Name=bond0
[Network]
DHCP=ipv4
20-eth0.network
[Match]
Name=eth0
[Network]
Bond=bond0
20-eth2.network
[Match]
Name=eth2
[Network]
Bond=bond0