ECMP (Equal-Cost Multipath)

Equal-Cost Multipath (ECMP) lets a forwarding device use multiple eligible next hops for the same destination prefix. It commonly distributes flows across those next hops using a hash of packet-header fields.

Equal paths and forwarding choices

An ECMP route represents multiple eligible next hops for the same destination prefix. How paths become eligible depends on the routing protocol and the device's multipath policy. Simply configuring two routers or receiving two BGP paths does not guarantee that both are installed for forwarding.

Many implementations select a next hop using a hash of fields such as source and destination addresses, protocol and transport ports. A flow can then keep using the same next hop while the eligible next-hop set stays stable. Which fields are used is implementation-dependent.

A two-node service example

Two service nodes advertise 203.0.113.40/32. An upstream router installs both 192.0.2.11 and 192.0.2.12 as next hops.

  • A connection from client A may hash to .11.
  • Another connection from client B may hash to .12.
  • Packets are forwarded along a chosen path; they are not copied to both nodes.

One large transfer can stay on one path, so ECMP is not a promise that a single download will combine both links' bandwidth. Even with many flows, equal path eligibility does not imply exactly equal byte counts.

Failure and return traffic

Removing a next hop changes the set of available paths. Depending on the hash scheme, some existing flows may move to a different node. If that node lacks the connection state or application session, the connection can fail even though the address is still reachable.

Return traffic can also follow a different path. Stateful firewalls, connection tracking and reverse-path checks must be considered when troubleshooting an asymmetric design.

Inspect the forwarding route

On Linux, a read-only inspection can start with:

ip -4 route show table main
ip -4 route get 203.0.113.40

A multipath entry can include more than one nexthop clause. The route table shows available paths; one lookup alone does not prove how all client flows will be distributed.

Common confusions

ECMP is network-layer path selection. It is not an HTTP load balancer and does not inherently check application health. Route withdrawal, neighbor resolution and application readiness are separate parts of a working design.

References

Explore networking learning paths