FreeBSD link aggregation and failover Filed Under: Linux & BSD
Introduction
First of all, a brief introduction on what is link aggregation. Basically to keep it sort, link aggregation is to virtually join two or more network interfaces so they appear as a single link. The good thing about this implementation is that depending the configuration you can make the server more resilient as all network cards interfaces are using the same IP address so in the case losing connection in one of the network cards we will still have connectivity to the network.
In FreeBSD link Aggregation and Failover (lagg interface) is supported in this modes:
- Failover: This is the default mode. In this mode one of the ports is setup as the master port and all data is received by that port. In the case that we lose that master port the next active port will be used.
- FEC: This is to support Cisco Etherchannel (PAgP). As this is a proprietary protocol it doesn’t support all settings from PAgP as a Cisco switch will do. If you want a port aggregation protocol use LACP instead.
- LACP: This mode supports the open standard of port aggregation called LACP (IEEE 802.3ad).
- Loadbalance: An alias of FEC.
- Roundrobin: As the name says it will use the NIC interfaces in a roundrobin fashion to send data and receive data and be able to received data on any interface. According with the FreeBSD documentation this will violate the Ethernet frame ordering and should be used with caution.
Failover configuration
To configure a server with dual NIC cards to have link aggregation with a failover mode we need to do the following changes:
Note: for this examples the network interfaces are named bge0 and bge1 and the lagg interface will be called lagg0
Add the following line in your /boot/loader.conf file:
if_lagg_load="YES"
This line will load the required kernel module to allow you to configure lagg interfaces.
Manual configuration
To create the lagg interface manually by command line you need the following steps.
First of all make sure that the interfaces that you are going to aggregate don’t have any IP address configured.
Next we need to bring the interfaces to aggregate up.
ifconfig bge0 up
ifconfig bge1 up
Next we will need to create our virtual interface to configure lagg.
ifconfig lagg0 create
Finally we can configure the lagg interface.
ifconfig lagg0 up laggproto failover laggport bge0 laggport bge1 10.2.2.2
netmask 255.255.255.0
Just in case you wanted to add or remove an interface to the lagg interface you can use the following commands:
ifconfig lagg0 laggport interface
– Use this command to add a port.
ifconfig lagg0 -laggport interface
– Use this command to remove a port.
Configuration of files so changes are permanent
To make the changes on the lagg interface permanent we will need to add the following lines to /etc/rc.conf file.
ifconfig_bge0="up"
ifconfig_bge1="up"
cloned_interfaces="lagg0"
ifconfig_lagg0="laggproto failover laggport bge0 laggport bge1"
ipv4_addrs_lagg0="10.2.2.2/24"
Command format to configure other modes
In the case you wanted to configure the lagg interface in a different mode follow the same steps but just modify the value after laggproto to the correct one to your configuration. The available options are:
failover | fec | lacp | loadbalance | roundrobin | none
So for example to do the same configuration as the one above but with LACP, you will need the command to be:
ifconfig lagg0 up laggproto lacp laggport bge0 laggport bge1 10.2.2.2 netmask 255.255.255.0
And on the /etc/rc.conf file the line would be:
ifconfig_lagg0="laggproto lacp laggport bge0 laggport bge1"
Troubleshooting
Here are a basic troubleshooting tip I found while configuring the lagg interface.
If the lagg interface is up and has a configured IP address and correct default gateway but is not pinging you will need to check the status of the lagg interface using ifconfig.
Here is the output of a working interface.
lagg0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
ether 00:11:85:5c:f1:65
inet 10.2.2.2 netmask 0xffffff00 broadcast 10.2.2.255
media: Ethernet autoselect
status: active
laggproto failover
laggport: bge1 flags=0<>
laggport: bge0 flags=5<MASTER,ACTIVE>
If your master interface or any of the other interfaces doesn’t have the ACTIVE part then there is a very high possibility than your interfaces are not up.
References
Bonding Interfaces in Linux. Tutorial in spanish on how to bond interfaces in Linux
Link Aggregation and Failover. How to configure Link aggregation and Failover from the FreeBSD book.
OpenBSD trunk interfaces. OpenBSD man page on trunk interfaces.
Tags: aggregation, etherchannel, failover, freebsd, lacp, lagg, link, port
- Permalink
- Alberto Diaz
- 23 Aug 2008 11:56 AM
- Comments (0)