TTR Networks

What is ECMP?

Equal-Cost Multi-Path

ECMP (Equal-Cost Multi-Path) is when a router installs several next hops for one destination whose paths cost exactly the same, and spreads traffic across them.

Normally a routing protocol picks one best path and installs it. If two or more paths tie on every criterion that matters, ECMP lets the router keep all of them: in OSPF that means the same total cost after SPF, and in BGP multipath it means the paths tie on the attributes the implementation compares. The forwarding table then holds several next hops for the prefix. To decide which packet goes where, the router hashes fields from each packet, typically the source and destination addresses, the protocol and the source and destination ports. Every packet of one flow produces the same hash, so a TCP connection stays on a single path and its packets arrive in order, while different flows spread across all the links. Implementations limit how many paths they will install; in FRR the setting is maximum-paths.

Leaf-spine data-centre fabrics are built around ECMP: each leaf has equal-cost paths through every spine, so adding a spine adds capacity. A common misunderstanding is expecting perfect balance. Because it works per flow, one very large flow can fill one link while another sits idle, and a handful of flows may hash unevenly. Another is "load balancing" across paths that are not truly equal, which ECMP will not do; you have to adjust costs until they tie. ECMP also makes troubleshooting harder, since traceroute probes with different ports can take different paths and show a mix of routers at the same hop. The OSPF Fundamentals lesson shows OSPF installing two next hops once a link cost is changed to create a tie.

Lessons that use ECMP

  • OSPF FundamentalsTeaches this term · Beginner · 70 min

    The link-state IGP that runs inside most networks: neighbour adjacencies, LSA flooding, SPF, costs, DR/BDR, areas and LSA types, a hands-on FRR lab, and how OSPF underpins BGP.

  • BGP on loopbacks vs interface addressesIntermediate · 45 min

    Why BGP sessions between loopbacks survive link failures and use parallel links, and what they need to work: an IGP or static routes, update-source, the eBGP connected check, and BFD. Every failure is reproduced on two real VyOS routers.

Related terms