Sub topic 1
Why Aggregate Links: Bandwidth and Redundancy
Link aggregation combines several physical Ethernet links between two devices into one logical link. Vendors call it a LAG (link aggregation group), a port channel, or EtherChannel. This chapter covers the problems it solves, what it does not solve, and the expectations you should have before you configure one. Later chapters cover the mechanics: hashing, LACP, configuration and troubleshooting.
Prerequisites
This chapter assumes you already know the following:
- Ethernet switching basics: MAC address learning, VLANs and trunks.
- Why switched networks need Spanning Tree Protocol (STP) to prevent loops, and that STP blocks redundant links.
- Basic switch CLI navigation.
- Basic IP addressing and TCP/UDP port numbers. These matter because flows are identified by them.
The two problems
A single link between two switches has two weaknesses.
- Capacity. A 1 Gbps uplink carries at most 1 Gbps in each direction. When the access switches behind it push more than that, frames queue and then drop.
- Availability. One cable, one transceiver, and one port on each side. If any of them fails, the connection is gone until something reroutes traffic.
Link aggregation addresses both with the same mechanism. You connect several links between the same two devices and present them to the rest of the network as one interface.
Why not just add parallel links?
If you plug a second cable between two switches without aggregation, STP sees a loop. It leaves one link forwarding and blocks the other. You gain redundancy and no extra bandwidth. The blocked link sits idle until the active one fails, and then STP has to reconverge.
A LAG changes this. Both switches treat the member links as a single logical port. STP sees one link, so it has no loop to break, and every member can forward traffic.
Options for getting more bandwidth
Aggregation is one of three ways to raise capacity between two switches. The right choice depends on cost, port availability and traffic shape.
| Option | Bandwidth gained | Redundancy | Main drawback |
|---|---|---|---|
| Replace with a faster link (for example 1G to 10G) | Full increase for every flow | None on its own | New optics, cabling or line cards. Ports may be unavailable. |
| Parallel links with STP | None | Failover after STP reconverges | One link sits idle |
| LAG of existing links | Increases aggregate capacity | Fast failover inside the bundle | Each flow is limited to one member's speed |
A LAG is attractive when you already own the ports and cables. It is also useful when speeds come in large steps. Going from 10G to 40G or 100G is a big jump in cost, while adding a second or third 10G member is a smaller one.
What "more bandwidth" really means
This is the point most often misunderstood. Four 1 Gbps links in a LAG do not create a 4 Gbps pipe for a single transfer. They create four 1 Gbps paths, and the switch assigns each flow to one of them.
The switch makes this assignment by hashing fields from the frame or packet, such as MAC addresses, IP addresses and TCP/UDP ports. The same inputs always produce the same member link. This is deliberate. If the switch sprayed the frames of one TCP connection across several links, they could arrive out of order. TCP would then see reordering, send duplicate acknowledgments and slow down. Keeping each flow on one link preserves frame order.
The consequence is that one flow can never exceed the speed of one member link. Aggregate throughput grows only when there are many flows that hash to different members.
The following script models this. It uses a simplified CRC-based hash, not the algorithm of any real switch.
import zlib
from collections import Counter
def pick_member(flow, n_links):
key = "|".join(str(field) for field in flow).encode()
return zlib.crc32(key) % n_links
# 1000 different TCP connections from one client to one server.
flows = [("10.0.0.5", "10.0.1.9", 50000 + i, 443, "tcp") for i in range(1000)]
# Many flows spread across both members, roughly evenly.
print(Counter(pick_member(f, 2) for f in flows))
# One flow always lands on the same member.
single = flows[0]
print({pick_member(single, 2) for _ in range(5)})The first line printed shows the 1000 flows split between member 0 and member 1, in roughly equal numbers. The second line prints a set with exactly one value, because repeated lookups for one flow never change the answer.
Why distribution is rarely perfect
Even with many flows, the split is statistical. Several things skew it:
- Few flows. With two members and only three large flows, two of them may share a member while the other member carries one.
- Elephant flows. One large flow, such as a bulk copy, can fill a member while others stay lightly loaded. Hashing does not move a flow because its link is busy.
- Poor hash inputs. If the switch hashes only on MAC addresses, and all traffic goes from many clients to one router MAC, many flows can share a single source and destination pair. They all land on one member. Choosing hash inputs that vary is covered in a later chapter.
- Member counts that do not divide evenly. Some platforms distribute unevenly across three, five, six or seven members, because the hash result is mapped to a fixed number of buckets. Powers of two, such as 2, 4 and 8, tend to balance best.
You should therefore plan capacity on the busiest member, not on the sum of all members. A 4 x 1G LAG that carries 3 Gbps on average may still drop frames if two heavy flows share one member.
How redundancy works
If a member link fails, the LAG stays up as long as at least one member remains. The switch removes the failed member from the distribution and rehashes flows across the remaining members. The flows that were using the failed link move to another one, and the others generally continue as before, depending on the platform.
Three points set realistic expectations.
- Failover is fast but not instant. Detecting loss of signal on a directly connected link typically takes tens to hundreds of milliseconds, and some TCP sessions will stall briefly. This is much faster than waiting for STP to reconverge.
- Capacity drops. After losing one of four 1G members, the LAG has 3 Gbps. If the load was above that, the remaining links congest. Size the LAG so the surviving members can carry the critical traffic.
- Redundancy covers links, not devices. All members connect the same two switches. If either switch fails, the whole LAG fails. Protection against switch failure needs a design where the members connect to two different switches, which a later chapter on multi-chassis aggregation covers.
Where link aggregation is used
- Between access and distribution or core switches, so that uplinks can grow past one port's speed.
- Between a switch and a server, where a host needs more than one NIC's bandwidth or must survive a cable or NIC failure.
- Between a switch and a storage or hypervisor host carrying many virtual machine flows, which hash well because there are many of them.
- Between two routers or firewalls that exchange traffic over many flows.
It is a poor fit when the main goal is to speed up one large single-stream transfer. A faster link is the answer there.
Common misunderstandings
- "Four links give one 4 Gbps connection." They give four 1 Gbps paths, and each flow uses one of them.
- "Aggregation replaces STP." STP still runs. It treats the bundle as one port, which is why the bundle does not create a loop. This is covered in a later chapter.
- "Mixing speeds is fine." Members normally must have matching speed and duplex. Hashing does not account for different speeds, so a slower member would be overloaded. Requirements for members are covered later.
- "A LAG protects against any failure between the switches." It protects against member failures. A misconfigured or mismatched bundle can instead cause failures, which is why negotiation protocols exist.
Summary
Link aggregation bundles parallel links into one logical link so that all of them forward and STP sees a single port. It raises aggregate capacity for traffic made of many flows and keeps the connection alive when a member fails. It does not make one flow faster than one member, it does not balance perfectly, and it does not protect against failure of a switch at either end. The next chapters build on this model, starting with what a LAG is and how frames are assigned to members.
Exercise
Two switches are joined by a LAG of four 1 Gbps members. A single backup job opens one TCP connection and copies data between two servers. Roughly what throughput can it reach, and why? What would you change so that the backup can use more of the bundle?
Show answer
About 1 Gbps at most. The switch hashes the flow's addresses and ports to pick one member, and the same flow always maps to the same member so that frames stay in order. Using several parallel TCP connections (different source ports) lets the hash place them on different members. If one stream must go faster, the fix is a faster link, not a LAG.
Exercise
A 2 x 10G LAG carries 14 Gbps of traffic in total, made of many small flows. One member fails. What happens to the traffic, and what should the design have accounted for?
Show answer
The LAG stays up on one 10G member and rehashes all flows onto it. Only 10 Gbps is available for 14 Gbps of demand, so the link congests and frames drop. The design should size the bundle so the surviving members can carry the critical load, or add members so that losing one still leaves enough capacity.