Bonding

From Playing with linux...
Jump to navigation Jump to search

linux network interface bonding

I wanted to make the following configuration:

bond2 (active-backup mode)
bond0 (802.3ad mode)bond1 (802.3ad mode)
eth0 (in switch 1)eth1 (in switch 1)eth2 (in switch 2)eth3 (in switch 2)

So I made the following:

#!/bin/sh
# load 3 bonds (in 802.3ad mode)
/sbin/modprobe bonding mode=4 miimon=100 downdelay=100 updelay=100 max_bonds=3
# put the last bond into active-backup mode
echo 1 >/sys/class/net/bond2/bonding/mode
/sbin/ifconfig bond0 up
/sbin/ifconfig bond1 up
/sbin/ifconfig bond2 10.0.0.1 netmask 255.255.255.0
/sbin/ifenslave bond0 eth0
/sbin/ifenslave bond0 eth1
/sbin/ifenslave bond1 eth2
/sbin/ifenslave bond1 eth3
/sbin/ifenslave bond2 bond0
/sbin/ifenslave bond2 bond1

So now bond2 is the active virtual network interface,
bond0 and bond1 are enslaved to bond2,
eth0 and eth1 are enslaved to bond0 and
eth2 and eth3 are enslaved to bond1.