CumulusNetworks / ifupdown2

GNU General Public License v2.0
161 stars 75 forks source link

systemd bond mac random at boot, then rechange on ifreload #269

Open aderumier opened 1 year ago

aderumier commented 1 year ago

Hi, tested on debian11,

since systemd v241 https://www.freedesktop.org/software/systemd/man/systemd.net-naming-scheme.html#v241

Like for bridge, bond interface are generated with random mac at boot, instead first slave mac

 

2: eth0: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 9200 qdisc mq master bond0 state UP group default qlen 1000
    link/ether e6:15:22:13:d0:2f brd ff:ff:ff:ff:ff:ff permaddr ec:0d:9a:8b:2a:dc
    altname enp130s0f0np0
3: eth1: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 9200 qdisc mq master bond0 state UP group default qlen 1000
    link/ether e6:15:22:13:d0:2f brd ff:ff:ff:ff:ff:ff permaddr ec:0d:9a:8b:2a:dd
    altname enp130s0f1np1
4: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 9200 qdisc noqueue master vmbr1 state UP group default qlen 1000
    link/ether e6:15:22:13:d0:2f brd ff:ff:ff:ff:ff:ff
 

Then, on next ifreload, the mac is change again (with down/up of bond0)

info: bond0: already exists, no change detected
info: bond0: invalid bond mac detected - resetting to eth0's mac (ec:0d:9a:8b:2a:dc)
info: bond0: netlink: ip link set dev bond0 down
info: bond0: netlink: ip link set dev bond0 address ec:0d:9a:8b:2a:dc
info: bond0: netlink: ip link set dev bond0 up

(This have trigger a bug in my production on reload).

It could be great to force mac in ifupdown2 at boot too. (like for bridge, when interface is just created) https://github.com/CumulusNetworks/ifupdown2/commit/46be38451258b95b045a82d86ace1d65f1270642

aderumier commented 1 year ago

seem easy to fix, patch sent:

https://github.com/CumulusNetworks/ifupdown2/pull/270

on first boot, mac is now correct:


2: eth0: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 9200 qdisc mq master bond0 state UP group default qlen 1000
    link/ether ec:0d:9a:8b:2a:dc brd ff:ff:ff:ff:ff:ff
    altname enp130s0f0np0
3: eth1: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 9200 qdisc mq master bond0 state UP group default qlen 1000
    link/ether ec:0d:9a:8b:2a:dc brd ff:ff:ff:ff:ff:ff permaddr ec:0d:9a:8b:2a:dd
    altname enp130s0f1np1
4: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 9200 qdisc noqueue master vmbr1 state UP group default qlen 1000
    link/ether ec:0d:9a:8b:2a:dc brd ff:ff:ff:ff:ff:ff