1) Configure the bonding kernel module to load on startup.
This step is unnecessary if your version of initscripts is newer than September 2003
Check the version with
'rpm -qi initscripts' or 'dpkg -s initscripts'
1 2 3 4 5 6 7 8 |
vi /etc/sysconfig/modules/bonding.modules #!/bin/bash if [ ! -d /sys/module/bonding ] ; then /sbin/modprobe bonding >/dev/null 2>&1 fi chmod +x /etc/sysconfig/modules/bonding.modules |
2) Configure the bond0 interface.
1 2 3 4 5 6 7 8 9 10 11 |
vi /etc/sysconfig/network-scripts/ifcfg-bond0 DEVICE=bond0 IPADDR=x.x.x.x NETMASK=x.x.x.x GATEWAY=x.x.x.x ONBOOT=yes BOOTPROTO=none USERCTL=no NM_CONTROLLED=no BONDING_OPTS="mode=balance-alb miimon=100" |
For detailed BONDING_OPTS configuration options see Specific Kernel Module Capabilities
GATEWAY=x.x.x.x can be replaced with PREFIX=x if you wish to use CIDR notation
3) Configure the physical interfaces. Replace any existing file contents.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
vi /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 BOOTPROTO=none ONBOOT=yes MASTER=bond0 SLAVE=yes USERCTL=no NM_CONTROLLED=no vi /etc/sysconfig/network-scripts/ifcfg-eth1 DEVICE=eth1 BOOTPROTO=none ONBOOT=yes MASTER=bond0 SLAVE=yes USERCTL=no NM_CONTROLLED=no |
5) Restart networking and check bond0.
1 2 3 4 |
service network restart ifconfig bond0 cat /sys/class/net/bonding_masters cat /proc/net/bonding/bond0 |
6) Check the status of bond0.
1 |
cat /proc/net/bonding/bond0 |
Sample LACP Setup
The example below uses the same config as above except for the BONDING_OPTS.
1 |
BONDING_OPTS="mode=802.3ad miimon=100" |
Example Cisco switch config:
1 2 3 4 5 6 7 8 9 10 11 12 |
int Port-channel1 description Port channel for linux switchport mode access no shut exit int range Gi0/1-2 description LACP Channel 1 channel-protocol lacp channel-group 1 mode active no shut exit |
See Cisco LACP Command Reference for more info on switch config.