In this post, I’m going to show you how to use link aggregation (via the Link Aggregation Control Protocol, or LACP) with Open vSwitch (OVS). First, though, let’s cover some basics.
In the virtualization space, it’s extremely common to want to use multiple physical network connections in your hypervisor hosts to support guest (virtual machine) traffic. The problem is that modern-day networking is—for now—largely constrained by the presence of Spanning Tree Protocol (STP), which limits the use of multiple connections between network devices (especially switches). Since most hypervisors have some form of virtual switch to support guest traffic, and since users don’t want to be constrained by STP the hypervisors have had to find workarounds.
VMware works around STP by causing their virtual switches to operate in what is called “end-host mode,” meaning that the virtual switch does not participate in STP (newer versions of vSphere can, in fact, block STP BPDUs from being emitted), the virtual switch does not forward frames received on one uplink back out another uplink, and traffic from VMs is statically assigned (pinned) to an uplink. (This behavior is, of course, configurable.) Because of these default behaviors, users in VMware environments simply connect multiple links to their hosts and off they go.
Other environments behave differently. Environments using Open vSwitch (OVS), for example, need to use other methods to work around the presence of STP, especially considering that OVS is more a full-featured virtual switch than the standard VMware vSwitch. In most cases, the workaround involves the use of link aggregation; specifically, the use of Link Aggregation Control Protocol (LACP), a standardized protocol that allows devices to automatically negotiate the configuration and use of link aggregates comprised of multiple physical links.
Now that you have the background, let’s dive into the details of how to make this work. These instructions on using LACP with OVS do make a few assumptions:
This post was written using Ubuntu 12.04.1 LTS and Open vSwitch 1.4.0 (installed using apt-get
directly from the Precise Pangolin repositories). The use of a different Linux distribution and/or a different version of OVS might make this process slightly different.
The first step is to add a bridge (substitute your desired bridge name forovsbr1
in the following command):
Once the bridge is established, then you’ll need to create a bond. This is the actual link aggregate on OVS. The syntax for adding a bond looks something like this:
So, if you wanted to add a bond to ovsbr1
using physical interfaces eth1
andeth3
, your command would look something like this:
However, there’s a problem with this configuration: by default, LACP isn’t enabled on a bond. To fix this, you have two options.
For option #1, you’ll simply append lacp=active
to the command to create the bond, like so:
For option #2, you’d use ovs-vsctl set
to modify the properties of the bond. Here’s an example:
Once the bond is created and LACP is enabled, you can check the configuration and/or status of the bond. Assuming that you’ve already configured your physical switch correctly, your bond should be working and passing traffic. You can use this command to see the status of the bond:
The output from that command will look something like this:
This command will show more detailed LACP-specific information:
This command returns a great deal of information; here’s a quick snippet:
You can also use this command to view the configuration details of the bond:
The output from this command will look something like this:
In learning how to use LACP with OVS, I found this article to be extremely helpful.
If you have questions, or have additional information to share with me and/or other readers, please speak up in the comments. Thanks!