What is ECMP, and how does a Cisco router share traffic across equal paths?
Show the answer
Say this first
Equal-cost multipath installs several paths with the same best metric for one prefix. On IOS, OSPF, EIGRP
and RIP install up to 4 by default and BGP only 1; maximum-paths raises it to the platform limit. CEF
shares traffic per flow: it hashes source and destination addresses so packets of one flow stay on one
path and arrive in order. EIGRP can also share unequal paths with variance.
Go deeper
What it looks like
O 10.1.0.0/24 [110/2] via 10.0.12.2, 01:12:44, GigabitEthernet0/0/1
[110/2] via 10.0.13.2, 01:12:44, GigabitEthernet0/0/2Configuration
router ospf 1
maximum-paths 8
!
router bgp 65001
address-family ipv4
maximum-paths 4
maximum-paths ibgp 4BGP is pickier
BGP only treats paths as multipath candidates when they tie on weight, local preference, AS path length,
origin and MED, are of the same type (all eBGP or all iBGP) and have the same IGP cost to the next hop.
By default the AS paths must also be identical; bgp bestpath as-path multipath-relax relaxes that to the
same length, which is common when multihoming to two providers.
Per flow, not per packet
Per-packet sharing (ip load-sharing per-packet on the interface) spreads load evenly but reorders TCP
segments, which causes duplicate ACKs and slows transfers. Per-flow is the default and the right choice.
The cost is that one large flow can only ever use one link.
They will ask next
Do two equal static routes give you ECMP?
Yes. Two statics to the same prefix with the same AD are both installed and CEF shares across them.
How do you check which path one flow takes?
show ip cef exact-route <source> <destination>runs the hash and prints the chosen exit interface and next hop.
Traps
- Saying ECMP doubles the speed of a single download. A single flow stays on one path.
- Forgetting that BGP defaults to one path. Without
maximum-paths, the second ISP link sits idle for outbound traffic.