7021380: How to test an active-backup bond from the console

Removing one of the slaves as a device from the system will causethe bond to no longer see it.

If the device that was removed was the active slave when it wasremoved, then the bond would be forced to react to that change andmake another slaved device active.

This document will use bond0 which is enslaving eth0 and eth1 toexplain how to remove a device and restore it, so that you can seehow bonding responds to those changes.

Step 1 – Check to see which slave is active:

cat /proc/net/bonding/bond0

Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)

Bonding Mode: fault-tolerance (active-backup)

Primary Slave: None

Currently Active Slave: eth0

MII Status: up

MII Polling Interval (ms): 100

Up Delay (ms): 0

Down Delay (ms): 0

Slave Interface: eth1

MII Status: up

Speed: 10000 Mbps

Duplex: full

Link Failure Count: 0

Permanent HW addr: 00:0c:29:ab:2a:fa

Slave queue ID: 0

Slave Interface: eth0

MII Status: up

Speed: 10000 Mbps

Duplex: full

Link Failure Count: 0

Permanent HW addr: 00:0c:29:ab:2a:f0

Slave queue ID: 0

According to the output eth0 is the active slave.

Step 2 -Find the active slaves device files (eth0 in thiscase)

find /sys -name *eth0




Step 3 – cd to the pci* directory

Example: /sys/devices/pci000:00/000:00:15.0

Step 4

echo 1 > remove

At this point the eth0 device directory structure that waspreviously located under /sys/devices/pci000:00/000:00:15.0 is nolonger there. It was removed and the device no longer existsas seen by the OS.

You can verify this is the case with a simple ifconfig which willno longer list the eth0 device.

You can also repeat the cat /proc/net/bonding/bond0 command fromStep 1 to see that eth0 is no longer listed as active oravailable.

You can also see the change in the messages file. It mightlook something like this:

2017-09-12T14:13:23.363414-06:00 tdefreese6 wickedd-nanny[766]:device eth0: device has been deleted

2017-09-12T14:13:23.368745-06:00 tdefreese6 kernel: [81594.846099]bonding: bond0: releasing active interface eth0

2017-09-12T14:13:23.368763-06:00 tdefreese6 kernel: [81594.846105]bonding: bond0: Warning: the permanent HWaddr of eth0 -00:0c:29:ab:2a:f0 – is still in use by bond0. Set the HWaddr ofeth0 to a different address to avoid conflicts.

2017-09-12T14:13:23.368765-06:00 tdefreese6 kernel: [81594.846132]bonding: bond0: making interface eth1 the new active one.

That concludes the test for fail over on active slavefailure.

You can get the deleted device back with a reboot of theserver.

You can also get the deleted device back with this command:

echo 1 > /sys/bus/pci/rescan

The eth0 interface should now be back

You can see that it is back with an ifconfig command, and you can verifythat the bond sees it with this command:

cat /proc/net/bonding/bond0

That concludes the test of the bond code seeing the device when itcomes back again.

The same steps can be repeated only this time using the eth1 deviceand file structure to fail the active slave in the bond back overto eth0.


Leave a Reply