Link Aggregation and LACP: Combining Several Cables Between Switches
Why two cables create a loop, LAG and EtherChannel, IEEE 802.1AX and active and passive LACP, static LAG, per-flow hashing, redundancy, member requirements, NAS, OPNsense and Spanning Tree.
Two switches joined by a single cable: the nightly backup to the NAS saturates the link and, if that cable comes loose, half the office is cut off. The solution looks obvious: add a second cable. A few seconds later, however, the network freezes, or Spanning Tree shuts down one of the two links and the bandwidth stays exactly as it was. How do you really combine several cables between two devices? With link aggregation and the LACP protocol. Let us see how they work, what they negotiate, why a single transfer does not get twice as fast and how to configure a LAG towards a switch, a NAS or an OPNsense firewall.
Why two cables are not enough
To a switch, two cables to the same device are two independent paths. A broadcast arriving on the first cable is forwarded on the second, comes back and starts again: it is a layer 2 loop. If Spanning Tree is not running, as on many unmanaged switches, a broadcast storm and a frozen network follow within seconds. If it is running, it does its job: it blocks one of the two ports. The network works, but the second cable stays in reserve and carries no traffic. The mechanism is explained in detail in the article on Spanning Tree.
The MAC address table suffers too: the same sender appears first on one port, then on the other, and the switch no longer knows where to send frames. How a switch learns addresses is described in the article on switches and the MAC table. To use both cables, the two switches must therefore treat them as a single link.
LAG, EtherChannel, bond: the same idea
Link aggregation groups several physical ports into a single logical interface called a LAG (Link Aggregation Group). The switch treats the group as one port: it learns MAC addresses on the LAG rather than on the individual cables, forwards a broadcast only once and applies VLANs and Spanning Tree to the group. The names vary with the vendor and the system: port-channel or EtherChannel on many switches, trunk on some devices (careful: here the word does not mean a VLAN trunk), bond on Linux and many NAS units, LAGG on FreeBSD and therefore on OPNsense.
The standard is IEEE 802.1AX. Link aggregation was originally clause 43 of IEEE 802.3ad (2000); in 2008 it moved to 802.1AX, which today also includes the control protocol, LACP (Link Aggregation Control Protocol). Many menus still say “802.3ad”.
LACP: what it negotiates
With LACP the two devices exchange messages called LACPDUs, sent to the reserved multicast address 01:80:C2:00:00:02 (the slow protocols group, EtherType 0x8809). Each LACPDU describes who is sending it and what it has learnt about the other side:
- System ID: the system priority and the MAC address of the device. If the two cables end up on different switches, the System IDs do not match and the wrong port does not join the group.
- Key: a number identifying the ports that can be aggregated together. Ports with incompatible speeds or settings get different keys.
- Port priority and number: they decide which members stay active when there are more than the device allows.
- State: bits showing whether the port is active or passive, whether it uses the short or long timeout, whether it is in sync and whether it is already receiving (collecting) and sending (distributing) traffic.
A port really joins the LAG only when both sides agree. LACPDUs also monitor the link: at the slow rate they are sent every 30 seconds and the partner is declared lost after 90; at the fast rate they are sent every second and the timeout is 3 seconds. The fast rate detects sooner a fault that does not bring the physical link down, such as a stuck media converter.
Each LACP port is either active, meaning it sends LACPDUs on its own initiative, or passive, meaning it only replies. One active side is enough; if both are passive nobody starts and the LAG never forms.
| Side A | Side B | Result |
|---|---|---|
| LACP active | LACP active | LAG negotiated: the recommended choice |
| LACP active | LACP passive | LAG negotiated |
| LACP passive | LACP passive | No LAG: nobody sends LACPDUs |
| LACP active | No LAG | The ports do not join the group; many switches keep only one active, others suspend them |
| Static LAG | No LAG | Risk of a loop and MAC flapping |
Static LAG: why it is risky
Almost every switch also allows a static LAG (in some menus “mode on” or “static”): the ports are aggregated by configuration, with no negotiation at all. It works, but the switch checks nothing. If the other side is not configured, the two cables go back to being two independent paths, with the loop and the unstable MAC table described above. If a cable ends up on the wrong port, or on another switch, nobody notices. If a member stops transmitting while the physical link stays up, the switch keeps sending part of the flows over it, and they are lost. Use a static LAG only when the other device does not support LACP; in every other case the right choice is active LACP.
How traffic is distributed: one flow, one cable
A LAG does not split frames across the cables. For each frame the switch computes a hash, a number derived from some header fields, and uses it to pick the member. The fields depend on the setting:
- layer 2: source and destination MAC addresses;
- layer 3: source and destination IP addresses (often together with the MACs);
- layer 4: IP addresses plus the TCP or UDP ports.
All the frames of the same flow have the same fields, hence the same hash, hence they always travel on the same cable. This is deliberate: frames arrive in the right order. The practical consequence matters: a single connection never exceeds the speed of one member. With two 1 Gbit/s cables, a file copy from a PC to the NAS stays at around 940 Mbit/s of useful throughput, just as with one cable. The gain shows when there are many flows: several PCs writing to the NAS at the same time, or several backups in parallel.
The type of hash matters. If all traffic goes from many PCs to a single router or a single NAS, a layer 2 hash may send almost everything over the same cable; a hash that includes IP addresses and ports spreads the load better. Each of the two devices independently chooses the cable for the traffic it sends: the two directions of a connection may use different members, and that is normal.
Redundancy: when a cable fails
If a member loses its link, the switch removes it from the group and redistributes the flows over the remaining members, normally within a fraction of a second. The LAG stays up, MAC addresses stay learnt on the LAG and Spanning Tree sees no topology change: bandwidth drops, the network keeps working. When the cable comes back, LACP renegotiates it and returns it to service. If instead the fault does not bring the physical link down, LACP notices only when the timeout expires: 3 seconds at the fast rate, 90 at the slow one.
Redundancy protects against the failure of a cable, a port or an SFP module, not of the whole switch: all members end on the same device. Connecting a server to two different switches needs dedicated solutions, such as a switch stack that behaves as a single device or a multi-chassis LAG (MC-LAG), which depend on the vendor.
The requirements: identical members
All members of a LAG must be configured the same way, on both sides. If they are not, LACP assigns different keys and the port stays out, or the switch suspends it.
- Same speed and full duplex. A member at 1 Gbit/s and one that negotiated 100 Mbit/s do not aggregate: a damaged cable or one of an unsuitable category can be enough. How to choose cables is explained in the article on Ethernet cables.
- Same VLANs. All access ports in the same VLAN, or all trunks with the same allowed VLANs and the same native VLAN. VLANs are configured on the LAG, not on the individual ports; how they work is described in the article on VLANs.
- Same port type and same MTU. Do not mix ports with different settings, for example jumbo frames on one member and not on the other.
- The same two devices. All cables run from the same switch to the same partner, unless you use a stack or MC-LAG.
- A managed switch. Unmanaged switches have neither LAG nor LACP: between two unmanaged switches use one cable only. The differences are described in the article on managed and unmanaged switches.
The number of active members depends on the device; many allow up to 8. On some switches the distribution is more even with 2, 4 or 8 members.
LAG and Spanning Tree
To Spanning Tree a LAG is a single port: BPDUs travel on one member, the logical port has a single role and a single state, and the cables in the group do not form a loop with each other. Many switches compute the LAG cost on the combined speed, so a LAG of two 1 Gbit/s members is preferred over a single 1 Gbit/s link. LAG and Spanning Tree are not alternatives: the LAG combines the cables between two devices, while Spanning Tree stays on to protect the rest of the network from loops.
The order of operations is crucial: configure the LAG on both switches and only then plug in the second cable. If the cable goes in first, for a while the two links are independent and it is up to Spanning Tree to prevent the loop.
Example: configuration between two switches
The syntax varies with the vendor; this indicative example uses commands similar to those of many managed switches. Ports 7 and 8 of SW1 form LAG 1 as a trunk carrying VLANs 10, 20 and 30; on SW2 the same is done with ports 1 and 2.
interface port-channel 1
description LAG to SW2
switchport mode trunk
switchport trunk allowed vlan 10,20,30
!
interface range gi1/0/7-8
description members of LAG 1
channel-group 1 mode active
In web interfaces the procedure is similar: create the LAG, choose LACP (or “dynamic”) mode, add the ports and configure the VLANs on the LAG. To check the status, the summary command or page shows the members and the partner. An indicative example:
LAG 1 protocol LACP status UP speed 2 Gbit/s
Partner priority 32768 MAC 00:00:5E:00:53:02
Port LACP state Speed Partner
7 active, bundled 1G full port 1
8 active, bundled 1G full port 2
If a port shows as “suspended”, “individual” or without a partner, the cause is almost always a configuration difference between members or the lack of LACP on the other side.
LAG to a NAS or a server
Many NAS units and servers have two or more network ports and let you create a bond. The mode to choose is the dynamic IEEE 802.3ad mode (LACP), matched by an LACP LAG on the switch. On Linux it corresponds to the 802.3ad mode of the bonding driver, with a hash policy for outgoing traffic (layer2, layer2+3 or layer3+4). The status can be read in the file /proc/net/bonding/bond0; an indicative extract:
Bonding Mode: IEEE 802.3ad Dynamic link aggregation
Transmit Hash Policy: layer3+4 (1)
LACP rate: fast
Slave Interface: eth0
MII Status: up
Speed: 1000 Mbps
Duplex: full
Slave Interface: eth1
MII Status: up
Speed: 1000 Mbps
Duplex: full
A NAS with two aggregated ports serves several clients at once better, but a copy from a single PC is still limited by that PC's port and by a single member. Some NAS units also offer modes that need no switch configuration, such as plain failover (one active port and one standby): they give redundancy, not aggregated bandwidth.
LAG to an OPNsense firewall
OPNsense, which is based on FreeBSD, calls aggregation LAGG. You create it from the interfaces menu, usually under Interfaces → Other Types → LAGG; the menus may vary with the version. Choose the member physical interfaces, which must not already be assigned or in use, and the LACP protocol; the fast rate and the hash type are options on the same page. The logical interface lagg0 is then assigned as LAN, or becomes the parent of the VLANs.
It is wise to prepare the LAGG from the console or from an interface other than the one being changed: moving the LAN to lagg0 briefly interrupts access to the management interface. Save a configuration backup before you start. From the shell, check the status with ifconfig lagg0; an indicative extract:
lagg0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
laggproto lacp lagghash l2,l3,l4
laggport: igb1 flags=1c<ACTIVE,COLLECTING,DISTRIBUTING>
laggport: igb2 flags=1c<ACTIVE,COLLECTING,DISTRIBUTING>
inet 192.168.10.1 netmask 0xffffff00 broadcast 192.168.10.255
The COLLECTING and DISTRIBUTING flags show that the member is receiving and sending traffic; a member without them is connected but not aggregated.
Common mistakes
- Two cables without a LAG. Plugging in the second cable before configuring the LAG creates a loop. With unmanaged switches the network freezes; with Spanning Tree running one cable stays unused.
- LACP on one side only. The LAG does not form: depending on the device, only one port stays active or the ports are suspended. With a static LAG on one side only, you are back to the loop.
- Expecting 2 Gbit/s from a single transfer. A connection uses one member: a file copy stays at about 1 Gbit/s. A LAG increases total capacity, not the speed of a single flow.
- Members with different settings. Different VLANs, speed, duplex or MTU keep a port out of the group. Make changes on the LAG, not on the individual port.
- An unsuitable hash. With a MAC-only hash, traffic to a single router or NAS may all end up on the same cable. A hash on IP addresses and ports spreads it better.
- Both sides passive. Nobody sends LACPDUs and the LAG never starts. At least one side, ideally both, must be in active mode.
Conclusions
Two cables between two devices become an advantage only if they form a LAG: otherwise they are a loop, or a spare cable blocked by Spanning Tree. In practice:
- check that both devices support link aggregation with LACP (IEEE 802.1AX, or 802.3ad in the menus);
- create the LAG on both sides, in active LACP mode, with the same ports, speed, VLANs and MTU;
- configure the VLANs on the LAG and only then plug in the cables;
- check that every member shows as active and aggregated and that the partner is the expected one;
- choose a hash on IP addresses and ports when flows converge on a single server, a NAS or the firewall;
- remember that a single transfer never exceeds the speed of one member, and leave Spanning Tree enabled.
To go deeper into switching, VLANs and business networks with complete examples, the books and courses listed below are a good next step.
The video
Further reading
- Book: LOCAL AREA NETWORKS (LAN) — Volume 3: Switching, VLANs, and Business Networks (English edition)
- Book: LOCAL AREA NETWORKS (LAN) — Volume 1: Fundamentals, Technologies, and Infrastructure (English edition)
- Video course: Reti LAN in Pratica — Volume 1 (video course in Italian)
- Video course: Reti LAN da Zero: Switch, IP, Router, Wi-Fi e Internet (video course in Italian)
- Related article: Spanning Tree: Why One Extra Cable Can Bring Down the Whole Network
- Related article: How Does a Switch Know Where to Send Data?
- Related article: VLANs: Why Separating Networks Improves Security and Organisation
- Related article: Cat 5e, Cat 6 and Cat 6A: Which Ethernet Cable Should You Choose?
- Related article: Managed or Unmanaged Switch: Which One to Choose
- Specialization: LAN Networks
Technical sources
- IEEE Std 802.1AX — Link Aggregation — Current standard for link aggregation: LAGs, the Link Aggregation Control Protocol (LACP), System ID, keys, port states, active and passive modes, short and long timeouts.
- IEEE Std 802.3ad-2000 — The first definition of link aggregation and LACP as clause 43 of IEEE 802.3, later moved to IEEE 802.1AX in 2008.
- IEEE Std 802.3 — Ethernet — Slow protocols (address 01-80-C2-00-00-02, EtherType 0x8809), speed, duplex and auto-negotiation of Ethernet ports.
- IEEE Std 802.1Q — Bridges and Bridged Networks — VLANs and Spanning Tree (RSTP and MSTP): a LAG is treated as a single bridge port.
- Documentazione del kernel Linux — «Linux Ethernet Bonding Driver HOWTO» — The 802.3ad mode of the bonding driver, the layer2, layer2+3 and layer3+4 hash policies, the LACP rate and the /proc/net/bonding status file.
- FreeBSD, pagina di manuale lagg(4), e documentazione di OPNsense — The LAGG interface of FreeBSD and OPNsense: failover, LACP and other protocols, l2, l3 and l4 hashing, the ACTIVE, COLLECTING and DISTRIBUTING flags. OPNsense menus may vary with the version.
- RFC 7042 — MAC addresses reserved for documentation (00-00-5E-00-53-00 … 00-00-5E-00-53-FF), used in the examples.
Standards and official documentation available from the respective organisations.