LACP on RHEL 6.4 - Sat, Dec 7, 2013
LACP, or the link aggregation control protocol, is a network protocol that enables active/active redundancy between network-connected devices. A common use for LACP is providing more than one physical network link between server and switch for redundancy purposes. Unlike other methods for providing redundancy, LACP also makes the total bandwidth of the links usable, meaning nothing is wasted.
Under Linux, LACP is provided as part of the
bonding driver, specifically by passing the mode=4
option when loading the
module.
Once the module is loaded, you can use ifenslave to "enslave" (…phrasing…) the physical network interfaces to a bonding interface. The physical network interfaces must be connected to network ports that provide LACP, and have been configured with the same LACP admin key.
Of course, you don't need to screw around with module options and
ifenslave under most Linux distributions in order to configure an
LACP-capable interface. Under RHEL 6.4, it's a matter of configuring the
physical interfaces, and the bonding interface, using interface
configuration files, which are found in
/etc/sysconfig/network-scripts/
.
For a typical two interface LACP setup, you would need to create three interface definitions. The first two (or more, if you would like to configure additional interfaces) looks like this:
#/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
USERCTL=no
NM_CONTROLLED=no
ONBOOT=yes
BOOTPROTO=none
SLAVE=yes
MASTER=bond0
HWADDR=00:00:00:00:be:ef
Change the interface name in the filename (ifcfg-eth0
) and the
DEVICE=
line to match the interface name of the physical interface.
Also change the HWADDR=
line to match the MAC address of the interface
as well. This is really important, or the network scripts will freak out
and apply this configuration to any interface it wants to. You can find
the MAC address by looking at the output of ifconfig eth0
for the
interface, replacing eth0
with the interface name.
You will need to create one interface definition file per physical interface involved in the LACP link.
You then need to create the logical interface, bond0
. If you need to
create multiple logical interfaces out of multiple groups of physical
interfaces, in the MASTER=
line of the physical interface definition
files above, and in the name and DEVICE=
line of the logical interface
definition file below, you will need to substitute bond0
with bond1
etc.
#/etc/sysconfig/network-scripts/ifcfg-bond0
ONBOOT=yes
USERCTL=no
BOOTPROTO=none
BONDING_OPTS="mode=4"
NM_CONTROLLED=no
IPADDR=x.x.x.x
NETMASK=x.x.x.x
Note the BONDING_OPTS
"mode=4"= line. This configures the bonding
interface to use LACP. You can pass any options you like to the bonding
module here as well. I have listed the IPADDR
and NETMASK
lines here
to demonstration that the IP configuration should be recorded in the
logical bonding interface configuration file, not the physical interface
configuration files. If you are using a dynamic IP, you can set
BOOTPROTO=DHCP
to use DHCP instead of static IP configuration,
removing the IPADDR
and NETMASK
lines.
For more information about what you can and can't put into these configuration files, take a look here.