Packet Path/

ECMP Explained: How Data Centers Spread Traffic Across Every Link

ECMP turns a Clos fabric's dozens of equal-cost paths into real bandwidth — until identical hashes polarize traffic onto a few hot links. How the 5-tuple hash works, why polarization happens, and how to break it.

Routing · Intermediate · 9 min · October 2, 2026

Illustration of a spine-leaf fabric with flows spreading across many equal-cost links
In plain EnglishECMP lets a data-center switch use all of its parallel links at once instead of just one. It sorts traffic into flows (one video call, one download) and assigns each flow to a link using a hash of the packet headers. It works beautifully — until every switch makes the exact same choices and traffic piles onto a few hot links.

Start with the supermarket

It's Saturday morning and the supermarket has 8 checkout lanes open. There are two ways to get shoppers through. Option one: a single line feeds one lane, and the other seven lanes sit empty. Option two: shoppers pick lanes, and all eight ring up groceries at once.

Option one is classic routing: one best path, everything else idle. Option two is ECMP — Equal-Cost Multi-Path routing.

But there's a catch the supermarket knows well. You don't send items to different lanes — that would scramble everyone's groceries. You send whole shoppers to lanes. ECMP does the same: it never splits one flow across links (that would reorder packets and wreck TCP). It assigns each flow to one lane, and every packet of that flow follows.

One best path is a wasted fabric

Picture a modern spine-leaf data center: every leaf switch connects to every spine. Between any two racks there aren't one or two paths — there are dozens, all the same length, all the same cost. Classic routing picks exactly one best path and programs it into the forwarding table. The other thirty-one links become expensive decoration. You've built a 32-lane highway and you're driving every car down a single lane.

Equal-cost multi-path routing — ECMP — is the fix. When the routing table holds several equal-cost routes to the same destination, the router installs all of them and spreads traffic across every link. In hyperscale fabrics ECMP isn't an optimization; it is the forwarding model.

What ECMP actually does

It starts in the control plane. OSPF, IS-IS, or BGP computes routes; when several routes to a prefix tie — same OSPF cost, or BGP multipath policy — the RIB keeps all of them instead of one winner. The forwarding plane programs an ECMP group into the FIB: one destination, N next-hops, N egress interfaces.

Each arriving packet is assigned to one member of the group. The assignment happens in hardware, per packet, at line rate — and it must be consistent: every packet of a flow has to take the same path, or TCP sees reordering, assumes loss, and collapses its congestion window (TCP's way of saying "the network is struggling, I'll send slower" — a false alarm here, but a costly one). So the switch doesn't round-robin packets. It hashes flows.

The hash: five fields in, one link out

The classic ECMP hash input is the 5-tuple: source IP, destination IP, protocol, source port, destination port. The hash output picks the egress member, conceptually member = hash(fields) mod N — a hash is just a blender: same ingredients in, same smoothie out, every time.

Two properties carry the whole design. Determinism: the same 5-tuple always selects the same member, so flows never reorder. Distribution: across many flows, each member should receive roughly 1/N of them.

Burn this distinction in: ECMP balances flows, not bytes. Ten thousand small flows spread beautifully. Three elephant flows can land on the same member and saturate it while sibling links idle. "Even hash distribution" and "even link utilization" are not the same thing.

The hash assigns each flow to a link link = hash(5-tuple) mod 4 — same flow, same link, every time Leaf-1 hashes each flow Spines link 0link 1link 2link 3 10.0.1.7→10.0.2.9 :52134 → hash 0x3F2A → link 0 10.0.1.8→10.0.2.4 :443 → hash 0x91D5 → link 1 10.0.1.7→10.0.3.2 :60881 → hash 0x44BE → link 2 10.0.1.9→10.0.2.9 :27017 → hash 0x07C3 → link 3
Four flows, four links. The switch hashes each flow's 5-tuple and takes the result mod 4. Deterministic: flow 1 will ride link 0 on every packet, forever — no reordering.

Try the hash yourself

Type any 5-tuple (or step through the presets) and watch which link the hash picks. The function below is a simplified FNV-1a — real switches use proprietary hashes, but the idea is identical: same input, same link, every time.

hash = — → link —

link 0
link 1
link 2
link 3