Friday, July 27, 2018

Linux bonding example, bond multiple network interfaces into one

source: http://fibrevillage.com/sysadmin/411-linux-bonding-example-bond-multiple-network-interfaces-into-one

The Linux bonding driver provides a method for aggregating multiple network interfaces into a single logical “bonded” interface. The behavior of the bonded interfaces depends upon the mode; generally speaking, modes provide either hot standby or load balancing services. Additionally, link integrity monitoring may be performed.

peter@peter-linux-dell:~/works/src/cosmos/hostap$ modinfo bonding
filename:       /lib/modules/4.4.0-21-generic/kernel/drivers/net/bonding/bonding.ko
author:         Thomas Davis, tadavis@lbl.gov and many others
description:    Ethernet Channel Bonding Driver, v3.7.1
version:        3.7.1
license:        GPL
alias:          rtnl-link-bond
srcversion:     84775F8435FCD8AD1DB80FB
depends:     
intree:         Y
vermagic:       4.4.0-21-generic SMP mod_unload modversions

***********
example
***********



ip link add bond0 type bond mode 1 primary wlan1 miimon 100

ip link set wlan1 down
ip link set wlan1 master bond0
ip link set wlan3 down
ip link set wlan3 master bond0
ip link set bond0 up
ifconfig bond0 192.168.33.100

cat /proc/net/bonding/bond0
cat /sys/class/net/meshbond/bonding/primary
cat /sys/class/net/meshbond/bonding/slaves
cat /sys/class/net/meshbond/bonding/active_slave

* to switch primary interface
echo wlan1 > /sys/class/net/meshbond/bonding/primary
It will change active_slave too.

No comments:

Post a Comment