You are not logged in.

#1 2023-04-25 17:11:35

Moviuro
Member
Registered: 2012-06-03
Posts: 73

[SOLVED] bond interface does not switch back to primary slave

Hi all,

I'm using the wiki's proposed config for a bond interface: https://wiki.archlinux.org/title/System … _interface

moviuro@toxoplasmosis /etc/systemd/network % cat 30-bond0.network 
[Match]
Name=bond0

[Network]
DHCP=yes
IPv6PrivacyExtensions=yes
moviuro@toxoplasmosis /etc/systemd/network % cat 30-ethernet-bond0.network 
#https://wiki.archlinux.org/title/Systemd-networkd#Bonding_a_wired_and_wireless_interface
[Match]
MACAddress=xx:xx:xx:xx:xx:ac
#Name=enp4s0

[Network]
Bond=bond0
PrimarySlave=true
moviuro@toxoplasmosis /etc/systemd/network % cat 30-wireless-bond0.network 
#https://wiki.archlinux.org/title/Systemd-networkd#Bonding_a_wired_and_wireless_interface
[Match]
MACAddress=xx:xx:xx:xx:xx:c8

[Network]
Bond=bond0
moviuro@toxoplasmosis /etc/systemd/network % cat 30-bond0.netdev          
# https://wiki.archlinux.org/title/Systemd-networkd#Bonding_a_wired_and_wireless_interface
[NetDev]
Name=bond0
Kind=bond

[Bond]
Mode=active-backup
PrimaryReselectPolicy=always
MIIMonitorSec=1s

All is well and working: tcpdump(8) shows: no traffic on the WiFi interface, traffic on the wired interface.

# networkctl status bond0
● 3: bond0                                                                     
                     Link File: /usr/lib/systemd/network/99-default.link
                  Network File: /etc/systemd/network/30-bond0.network
                         State: routable (configured)
                  Online state: online                                         
                          Type: bond
                          Kind: bond
                        Driver: bonding
              Hardware Address: 8a:...
                           MTU: 1500 (min: 68, max: 65535)
                         QDisc: noqueue
  IPv6 Address Generation Mode: eui64
                          Mode: active-backup
                        Miimon: 1s
                       Updelay: 0
                     Downdelay: 0
      Number of Queues (Tx/Rx): 16/16
              Auto negotiation: no
                         Speed: 1Gbps
                        Duplex: full
                       Address: 192.168.1.111 (DHCP4 via 192.168.1.1)
[...]
                       Gateway: 192.168.1.1
                                fe80::...
                           DNS: 192.168.1.1
             Activation Policy: up
           Required For Online: yes
               DHCP4 Client ID: IAID:.../DUID
             DHCP6 Client DUID: DUID-EN/Vendor:...

After I unplug the ethernet cable, the WiFi interface gets all the traffic, all good.

# networkctl status bond0
● 3: bond0                                                                 
                     Link File: /usr/lib/systemd/network/99-default.link
                  Network File: /etc/systemd/network/30-bond0.network
                         State: degraded-carrier (configured)
                  Online state: offline
                          Type: bond
                          Kind: bond
                        Driver: bonding
              Hardware Address: 8a:...
                           MTU: 1500 (min: 68, max: 65535)
                         QDisc: noqueue
  IPv6 Address Generation Mode: eui64
                          Mode: active-backup
                        Miimon: 1s
                       Updelay: 0
                     Downdelay: 0
      Number of Queues (Tx/Rx): 16/16
              Auto negotiation: no
                       Address: 192.168.1.111 (DHCP4 via 192.168.1.1)
                                ...
                       Gateway: 192.168.1.1
                                fe80::...
                           DNS: 192.168.1.1
             Activation Policy: up
           Required For Online: yes
               DHCP4 Client ID: IAID:.../DUID
             DHCP6 Client DUID: DUID-EN/Vendor:...
# networkctl status enp4s0 
● 4: enp4s0                                                             
                     Link File: /usr/lib/systemd/network/99-default.link
                  Network File: n/a
                         State: no-carrier (unmanaged)
                  Online state: unknown
                          Type: ether
                          Path: pci-0000:04:00.0
                        Driver: igc
                        Vendor: Intel Corporation
                         Model: Ethernet Controller I225-V
              Hardware Address: 8a:...
    Permanent Hardware Address: 70:...ac (ASRock Incorporation)
                           MTU: 1500 (min: 68, max: 9216)
                         QDisc: mq
                        Master: bond0
  IPv6 Address Generation Mode: none
      Number of Queues (Tx/Rx): 4/4
              Auto negotiation: yes
                          Port: tp

I plug back the RJ45 cable and wait more than one second. tcpdump(8) running on the enp4s0 interface sees no traffic, everything still goes through WiFi.

# networkctl status bond0 
● 3: bond0                                                                     
                     Link File: /usr/lib/systemd/network/99-default.link
                  Network File: /etc/systemd/network/30-bond0.network
                         State: routable (configured)
                  Online state: online                                         
                          Type: bond
                          Kind: bond
                        Driver: bonding
              Hardware Address: 8a:...                           MTU: 1500 (min: 68, max: 65535)
                         QDisc: noqueue
  IPv6 Address Generation Mode: eui64
                          Mode: active-backup
                        Miimon: 1s
                       Updelay: 0
                     Downdelay: 0
      Number of Queues (Tx/Rx): 16/16
              Auto negotiation: no
                       Address: 192.168.1.111 (DHCP4 via 192.168.1.1)
                                ...
                       Gateway: 192.168.1.1
                                fe80::...
                           DNS: 192.168.1.1
             Activation Policy: up
           Required For Online: yes
               DHCP4 Client ID: IAID:.../DUID
             DHCP6 Client DUID: DUID-EN/Vendor:...
# networkctl status enp4s0 
● 4: enp4s0                                                             
                     Link File: /usr/lib/systemd/network/99-default.link
                  Network File: n/a
                         State: enslaved (unmanaged)
                  Online state: unknown
                          Type: ether
                          Path: pci-0000:04:00.0
                        Driver: igc
                        Vendor: Intel Corporation
                         Model: Ethernet Controller I225-V
              Hardware Address: 8a:...
    Permanent Hardware Address: 70:...ac (ASRock Incorporation)
                           MTU: 1500 (min: 68, max: 9216)
                         QDisc: mq
                        Master: bond0
  IPv6 Address Generation Mode: none
      Number of Queues (Tx/Rx): 4/4
              Auto negotiation: yes
                         Speed: 1Gbps
                        Duplex: full
                          Port: tp

For traffic to resume on the enp4s0 interface, I have to issue `systemctl restart wpa_supplicant@wlp5s0`; this is not expected behavior, as: the bond is in active-backup mode and enp4s0 is the primary (PrimarySlave=true under [Network]).

https://docs.kernel.org/networking/bonding.html

Last edited by Moviuro (2023-05-22 09:52:22)


bspwm, BTRFS over LUKS
Archlinux a lot, FreeBSD more and more...
Murphy's rule: The day you need a backup, you tell yourself you should have created some.

Offline

#2 2023-04-27 15:23:14

Moviuro
Member
Registered: 2012-06-03
Posts: 73

Re: [SOLVED] bond interface does not switch back to primary slave

I looked around in /sys/class/net/bond0/bonding, and surprise:

# wc -l < /sys/class/net/bond0/bonding/primary
0

Echo(1)ing the right interface fixes the issue but it shouldn't be necessary. Looks like a systemd-networkd bug.

# echo enp4s0 >> /sys/class/net/bond0/bonding/primary

Last edited by Moviuro (2023-05-09 13:36:56)


bspwm, BTRFS over LUKS
Archlinux a lot, FreeBSD more and more...
Murphy's rule: The day you need a backup, you tell yourself you should have created some.

Offline

#3 2023-05-22 09:53:55

Moviuro
Member
Registered: 2012-06-03
Posts: 73

Re: [SOLVED] bond interface does not switch back to primary slave

Matching on `MACAddress` doesn't work as expected. Using `PermanentMACAddress` instead solves the issue. Wiki has been updated, and upstream is considering better documentation on that pitfall.

https://wiki.archlinux.org/index.php?ti … did=776115


bspwm, BTRFS over LUKS
Archlinux a lot, FreeBSD more and more...
Murphy's rule: The day you need a backup, you tell yourself you should have created some.

Offline

Board footer

Powered by FluxBB