IEEE 802.3ad - Link aggregation on a CISCO Switch
In case you are wondering it's a stacked switch so the Gi1/0/* is one switch and Gi2/0/* is the other one, aiming for maximum redundancy. The interesting part is the channel-protocol lacp statement.
This article is the counterpart of bonding.
interface Port-channel1
description Po1 (Etherchannel Gi1/0/1, Gi2/0/1)
switchport trunk encapsulation dot1q
switchport mode access
storm-control broadcast level 0.50
storm-control multicast level 0.50
spanning-tree portfast
interface GigabitEthernet1/0/1
description Server - eth0 (Po1 link 1)
switchport access vlan 2
switchport mode access
load-interval 30
storm-control broadcast level 0.50
storm-control multicast level 0.50
channel-protocol lacp
channel-group 1 mode active
spanning-tree portfast
interface GigabitEthernet2/0/1
description Server - eth1 (Po1 link 1)
switchport access vlan 2
switchport mode access
load-interval 30
storm-control broadcast level 0.50
storm-control multicast level 0.50
channel-protocol lacp
channel-group 1 mode active
spanning-tree portfast
Configure bonding for IEEE 802.3ad (Link aggregation)
For details about bonding in general, see the Linux Ethernet Bonding Driver HOWTO
This article is the counterpart of port-channel.
Debian
/etc/network/interfaces
auto bond0 iface bond0 inet static address 192.168.0.10 netmask 255.255.255.0 slaves eth0 eth2 bond_miimon 100 bond_mode 802.3ad bond_lacp_rate fast allow-bond0 eth0 iface eth0 inet manual allow-bond0 eth2 iface eth2 inet manual
RedHat (CentOS, Scientific Linux, Fedora, ...)
For users of a ixgbe (Intel) nic: Careful with kernel releases between 2.6.194-8.1.el5 and 2.6.18-229.el5, you might run into RHEL bug #619070
/etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0 IPADDR=192.168.2.12 NETMASK=255.255.255.0 ONBOOT=yes BOOTPROTO=none USERCTL=no BONDING_OPTS="miimon=100 mode=802.3ad lacp_rate=fast"
/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0 BOOTPROTO=none ONBOOT=yes HWADDR=xx:xx:xx:xx:xx:xx MASTER=bond0 SLAVE=yes USERCTL=no
/etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1 BOOTPROTO=none ONBOOT=yes HWADDR=xx:xx:xx:xx:xx:xx MASTER=bond0 SLAVE=yes USERCTL=no
OpenSUSE
Presumably the same issue with the kernel as for RedHat. I haven't got it to work with 2.6.27.7-9-default (openSUSE 11.1).
/etc/sysconfig/network/ifcfg-bond0
STARTMODE='auto' BOOTPROTO='static' BONDING_MASTER=yes BONDING_SLAVE_1='eth0' BONDING_SLAVE_2='eth1' BONDING_MODULE_OPTS='mode=802.3ad miimon=100 lacp_rate=fast' IPADDR='192.168.0.10/24' NETWORK='192.168.0.0' USERCONTROL='no'
/etc/sysconfig/network/ifcfg-eth0
STARTMODE='off' BOOTPROTO='none' USERCONTROL='no'
/etc/sysconfig/network/ifcfg-eth1
STARTMODE='off' BOOTPROTO='none' USERCONTROL='no'
Setup a bridge on a bond
Debian 5 or later: /etc/network/interfaces
# The bridge interface.
# The lines with pre-up and post-down are to bring up the
# bond before the bridge. The '--allow "$IFACE"' parameter to
# ifup/ifdown and the corresponding "allow-br0 bond0" line aren't
# really needed, but I like them.
auto br0
iface br0 inet static
address 192.168.1.10
netmask 255.255.255.0
gateway 192.168.1.1
bridge_ports bond0
bridge_maxwait 0
pre-up ifup --allow "$IFACE" bond0
post-down ifdown --allow "$IFACE" bond0
# The bond interface
# notice it's set as manual to allow the scripts in ifenslave-2.6
# package to create the master interface and enslave the slaves.
allow-br0 bond0
iface bond0 inet manual
bond_slaves eth0 eth1
bond_miimon 100
bond_mode 802.3ad
bond_lacp_rate fast
# Alternative modes:
# balance-rr or 0
# active-backup or 1
# balance-xor or 2
# broadcast or 3
# 802.3ad or 4
# balance-tlb or 5
# balance-alb or 6
# Physical interfaces.
# Notice they are set as manual to permit you to add up/down commands
# and special directives such as wifi configurations.
# Lines beginning with allow-bond0 are required if you want to do
# something with these interfaces, otherwise you can remove both of
# them as they are brought up when they are enslaved to their master.
allow-bond0 eth0
iface eth0 inet manual
allow-bond0 eth1
iface eth1 inet manual
thx to Marco Nenciarini