A bonding configuration allow you to increase your bandwidth by merging several physical interfaces to a virtual one. LACP is a well known aggregation protocol, available in most switches and in Linux. This post will show you how to use LACP between a switch and a Linux server.
Linux
Load the kernel module
cat > /etc/modprobe.d/bond.conf << EOF
alias bond0 bonding
options bond0 miimon=100 mode=4 lacp_rate=1
EOF
Disable NetworkManager
Then, you need to disable NetworkManager.
systemctl stop NetworkManager.service
systemctl disable NetworkManager.service
Configure your physical interfaces
Choose your 2 (or more) network interfaces you want to join together. Their configuration must be the same : ethernet type (TX versus LX), speed, duplex, etc...
cat > /etc/sysconfig/network-scripts/ifcfg-p1p1 << EOF
BOOTPROTO="none"
NM_CONTROLLED=no
DEVICE="p1p1"
NAME=p1p1
ONBOOT=yes
SLAVE=yes
MASTER=bond0
EOF
Second interface :
cat > /etc/sysconfig/network-scripts/ifcfg-p1p2 << EOF
BOOTPROTO="none"
NM_CONTROLLED=no
DEVICE="p1p2"
NAME=p1p2
ONBOOT=yes
SLAVE=yes
MASTER=bond0
EOF
Create your virtual interface
Now you can add a new interface bond0
, which would be your virtual network interface :
cat > /etc/sysconfig/network-scripts/ifcfg-bond0 << EOF
BOOTPROTO="none"
DEVICE="bond0"
NAME=bond0
IPADDR=192.168.0.45
PREFIX=24
DNS1=192.168.0.2
GATEWAY=192.168.0.1
DOMAIN=local
DEFROUTE=yes
ONBOOT=yes
PEERDNS=yes
PEERROUTES=yes
USERCTL=no
EOF
Switch part
Let's now configure the switch. That's pretty simple. Just don't forget to apply any further configuration to the port channel interface, not the underlying physicals ones. If the configuration is different between 2 channel group member, then the port channel will be disabled and a traffic interruption will occur.
Also, configure the port channel using active
mode. Which means the switch tries to "negotiate" the channel. Other configuration options are passive
(wait for LACP negotiation) or on
(unconditionnaly build the port channel).
On Cisco switches you could add up to 8 members to your channel group.
Cisco IOS
interface GigabitEthernet2
description SERVER1_p1p1
channel-group 1 mode active
!
interface GigabitEthernet3
description SERVER1_p1p2
channel-group 1 mode active
!
interface Port-channel1
description SERVER1`
!
Dell
The Dell syntax is the same as Cisco IOS.
interface Te1/0/1
channel-group 1 mode active
description "SERVER1_p1p1"
!
interface Te1/0/2
channel-group 1 mode active
description "SERVER1_p1p2"
!
interface port-channel 1
description "SERVER1"
!
Check your configuration
On your Linux box
cat /proc/net/bonding/bond0
On your switch
Dell
show interfaces status port-channel 1
Cisco
show interface po 1