OS - Linux - Networking - Bonding - Notes

CloudiBee - Linux Network bonding – setup guide

Check the status of a bond:

cat /proc/net/bonding/bond0

Source:Kudithipudi.org - HOW TO : Check status of bond interface in Linux

Change active slave in an active/backup bond (to em1):

ifenslave -c bond0 em1

Source:The Geek Diary - RedHat / CentOS : How to change currently active slave interface of bonding online

Change the active slave in an active/backup bond on older versions of Linux:

# Remove the currently active interface from the bond
echo -eth1 > /sys/class/net/bond0/bonding/slaves
# Re-add the interface to the bond
echo +eth1 > /sys/class/net/bond0/bonding/slaves

Source:blog.erben.sk - How to change Currently Active Slave when runnning bonding in active-backup mode

Create a bond (with vlan) on the commandline

With ifconfig and vconfig:

ifconfig eth2 down
ifconfig eth3 down
ifconfig bond0 up
ifenslave bond0 eth2 eth3
vconfig add bond0 4
ifconfig bond0.4 10.20.4.200 netmask 255.255.255.0
ifconfig eth2 up
ifconfig eth3 up
ifconfig bond0.4 up

With (only) ip:

ip link set dev eth2 down
ip link set dev eth3 down
ip link add bond0 type bond
ip link add link bond0 name bond0.4 type vlan id 4
ip address add 10.20.4.200/24 dev bond0.4
ip link set eth2 master bond0
ip link set eth3 master bond0
ip link set dev eth2 up
ip link set dev eth3 up
ip link set dev bond0 up
ip link set dev bond0.4 up

Sources: