Sub topic 11
Link Failure, Rehashing and Minimum Links
This chapter assumes you know how a port channel distributes flows with a hash, how LACP negotiates a bundle, and how to read show etherchannel summary. It covers what happens when a member link fails or returns, and how to stop a degraded bundle from causing worse problems than an outage.
What happens when a member fails
A port channel is a logical interface. Its state does not depend on every member being up. If one member of a two-link bundle fails, the logical interface stays up. The switch removes the failed member from the set of links it can use, and traffic continues on the survivors.
Frames that were already using the failed link are lost for a short time. Other flows are not affected, because they still hash to a working member. Hardware-based detection and local rehashing are usually fast. Typical failover for a local link-down event is in the tens of milliseconds, though the exact figure depends on the platform. TCP usually recovers the lost segments with retransmission, so applications often see a brief stall instead of a broken session.
Rehashing
The hash function maps each flow to a slot, and slots map to member links. When the member count changes, the switch rebuilds that mapping.
Many platforms compute hash % n_links. With this approach, changing n can move many flows, not only the ones on the failed link. Other platforms use a fixed table of buckets (for example 8 buckets) and reassign only the buckets that pointed to the failed link. Behavior varies by vendor and chip, so check your platform documentation if flow stability matters.
The following Python model shows the difference. It uses the same CRC-based approach as the simple hash model, then counts how many flows change member when one of three links is removed.
import zlib
def pick_member(flow, n_links):
key = "|".join(str(x) for x in flow).encode()
return zlib.crc32(key) % n_links
flows = [("10.0.0.5", "10.0.1.9", 40000 + i, 443, "tcp") for i in range(1000)]
before = [pick_member(f, 3) for f in flows]
after = [pick_member(f, 2) for f in flows]
moved = sum(1 for b, a in zip(before, after) if b != a)
print(f"Flows that changed member when 3 links became 2: {moved} of {len(flows)}")With simple modulo, roughly two thirds of the flows move, not just the one third that used the failed link. A bucket-based design would move only about one third. Flows that move may arrive out of order at the receiver for a moment, because packets sent on the old link can still be in transit while new packets use another link.
How failure is detected
Detection depends on the failure type.
| Failure type | Detected by | Typical speed |
|---|---|---|
| Cable pulled, transceiver fails, remote port shut down | Physical link-down signal | Very fast (milliseconds) |
| Link stays up but the far end stops sending LACPDUs | LACP timeout | Seconds (3 × the LACPDU interval) |
| Link stays up but traffic is silently dropped (for example, a failing media converter or a fault in a transport device between the switches) | Nothing at layer 2 unless LACP also stops | Slow or never |
The LACPDU interval is 30 seconds for the slow rate and 1 second for the fast rate. The timeout is three times the interval, so slow mode can take about 90 seconds to notice a silent failure, and fast mode about 3 seconds. This is why the Linux example earlier used lacp_rate fast. On Cisco IOS style switches, the equivalent setting is lacp rate fast on the interface, where supported.
Both ends should use compatible rates. Each side sets how often its partner should send LACPDUs, and a mismatch does not break the bundle, but detection time then depends on which side is slow.
Static bundles have no LACPDUs. A static bundle detects only physical link-down events. If a link stays up but passes no traffic, the switch keeps hashing flows to it, and those flows are blackholed. This is one of the main risks of static mode.
Recovery and flapping
When a failed link returns, LACP negotiates it back into the bundle. The switch then rehashes again, and some flows move back. A link that goes up and down repeatedly causes repeated rehashing and repeated brief disruption. This is called flapping.
Common causes are a bad cable or transceiver, an auto-negotiation problem, or a power-saving feature on a connected device. Look at interface error counters and the switch log for repeated up/down messages. Fix the physical cause. Some platforms also provide link debounce or error-disable recovery settings, which can dampen flaps, but they hide the symptom rather than repair the link.
Capacity after failure
Losing a member reduces the total bandwidth of the bundle. Consider a 2 × 10 Gbps bundle carrying 14 Gbps of traffic. With both links up, each link carries about 7 Gbps. After one link fails, the remaining link is offered 14 Gbps, and it can forward only 10. The excess is dropped, and every flow on that link suffers, including flows that were not originally on the failed link.
A port channel therefore protects against link loss only if the surviving members can carry the offered load. When you size a bundle, decide how much traffic you must carry during a single-link failure, not only during normal operation.
Minimum links
Keeping a port channel up with too little capacity can be worse than taking it down, especially when a redundant path exists. The minimum links setting lets you define how many members must be active for the port channel to stay up. If the active count falls below the threshold, the switch brings the whole port channel down.
On a Cisco IOS style switch, you set it on the port-channel interface:
interface Port-channel1
port-channel min-links 2On Linux bonding, the equivalent is the min_links option:
ip link set bond0 type bond min_links 2When the threshold is not met, traffic fails over to another path. That path can be a second port channel, a different uplink chosen by spanning tree, or another switch in an MLAG design. This only helps if such an alternative exists. If the port channel is the only path, forcing it down turns degraded service into no service.
Choosing a value
- With
min-links 1(the usual default), the bundle stays up as long as one member works. - With
min-linksequal to the number of members, any single failure takes the bundle down. This suits designs where a standby path has full capacity. - Intermediate values suit bundles of three or more links, where losing one link is acceptable but losing two is not.
Set the value on both ends. Each side evaluates its own active member count, and the two sides can disagree about whether the bundle is usable.
Hot-standby members
If more members are configured than can be active, LACP marks the extra ones as standby. They are bundled in name only and do not forward user traffic. If an active member fails, a standby member takes its place. This keeps the active count constant without manual changes. In show etherchannel summary, active members show the flag P (bundled in port-channel) and standby members show H (hot-standby).
You can influence which links are chosen with the interface-level lacp port-priority command. A lower number wins. The decision is made by the device with the lower system priority, and the other side follows. If you want a particular pair of links to be preferred, set priorities on the device that holds the lower system ID.
Verifying failure behavior
Test a failure before production depends on it. A reasonable test plan is:
- Start a long-running transfer or several parallel flows between two hosts across the bundle.
- Check
show etherchannel summaryandshow lacp neighborto confirm all members are bundled. - Shut down one member with
shutdownon the interface, or unplug the cable. - Observe how long traffic stalls, using a continuous ping with a short interval or a throughput tool.
- Confirm the port channel stays up, or goes down if
min-linksis crossed, and that traffic moves to the expected alternative path. - Restore the link and confirm it rejoins the bundle without a long outage.
Repeat the test on both sides of the bundle and with a silent-failure case if you can simulate one, for example by filtering LACPDUs with an access control list on a test link.
Exercise
A port channel has four 10 Gbps members and carries 28 Gbps at peak. It is configured with port-channel min-links 2. Two members fail. What happens to the port channel, and is it the right setting for this load?
Show answer
Two members remain active, so the active count (2) meets the minimum of 2 and the port channel stays up. However, the remaining capacity is 20 Gbps, which is less than the 28 Gbps peak, so traffic will be dropped during peaks. A value of min-links 3 would take the port channel down after the second failure and push traffic to an alternative path, but only if that path exists and can carry the load. The better design choice depends on whether a redundant path with enough capacity is available.
Exercise
Why can a failure that leaves the link physically up but passes no traffic be more damaging in a static port channel than in an LACP port channel?
Show answer
A static port channel has no control protocol, so it detects only physical link-down. It keeps hashing flows to the silent member, and those flows are dropped. LACP members must keep exchanging LACPDUs, so after the timeout (about 3 seconds in fast mode, about 90 seconds in slow mode) the switch removes the silent member and rehashes flows onto working links.