Wiki DE Start in the browser

Wiki › Protocols

ECMP (equal-cost paths)

If several paths with the same cost lead to the destination, the router uses all of them. It does not spread each packet but each flow.

Layer
3 (Vermittlung)
Standard
RFC 2992, RFC 2328
See an example
See demo

Two paths, equally good

Normally a router picks exactly one route for a destination: longest prefix, then smallest administrative distance, then smallest metric. If two or more routes are still equally good, this is called equal-cost multi-path (ECMP). The router installs all of them and spreads the load. If one path fails, the packets use the remaining ones.

  • Static: two routes to the same network with the same distance but a different gateway.
  • OSPF: paths with the same total cost (RFC 2328, section 16.1).

Per flow, not per packet

If the router alternated packets, they would arrive out of order and TCP would retransmit needlessly. So it computes a hash over source, destination, protocol and ports (for ICMP the identifier) and divides the number range into equal parts, one per path (hash threshold, RFC 2992). All packets of a connection take the same path; different connections are spread. With few connections the distribution may be uneven.

In leyoNET

Up to four equal paths for static routes and OSPFv2. show ip route marks every active path with >*, the routing table shows both entries. In the demo the traceroutes of two PCs take different paths; if you remove a cable, only one remains. The same route twice cannot be added; with another distance it becomes a backup route (Static routing).

How to do it in leyoNET

The same text as in the app’s help (F1 key).

Equal-cost paths (ECMP)

If two or more paths with equal cost lead to the same destination, routers use all of them (equal-cost multi-path, up to 4 paths). This spreads the load and adds a backup.

  • Static: two routes to the same network with the same distance but a different gateway (ip route 10.4.0.0/24 10.0.12.2 and ip route 10.4.0.0/24 10.0.13.3). The same route twice is not allowed; with another distance it becomes a backup route.
  • OSPF: paths with equal cost are all installed (RFC 2328).
  • Traffic is spread per flow, not per packet: a hash over source, destination, protocol and ports picks the path (hash threshold, RFC 2992). This keeps the packets of a connection in order; pings from different computers may take different paths.

show ip route marks every active path with >*. If a path fails, the flows use the remaining ones.

See an example

  • ECMP: two equal paths

    Router 1 reaches the server network via Router 2 or Router 3, both paths cost the same. OSPF installs both, and the router spreads the flows by a hash (RFC 2992).

    Routing table of Router 1: two O routes to 10.4.0.0/24. The traceroutes from PC 1 and PC 2 may take different paths. Remove a cable to Router 2: everything uses Router 3.

    Watch live Project file

“Watch live” opens the network in leyoNET, the simulation runs in a loop. In the app you find it under File → Demo networks, with a step-by-step tour.

Practise

  • ★★★★☆ Use two paths (ECMP) · 3 goals · Worksheet (German)

In leyoNET under Tools → Exercise catalogue. Every exercise checks itself.

What leyoNET simplifies

ProtocolLayerSimplification in the simulation
ECMP (equal-cost paths)3Up to 4 paths for static routes (same distance, other gateway) and OSPFv2 (same cost); path per flow by hash threshold over addresses, protocol and ports or ICMP identifier; not for RIP, BGP, IPv6

Standards

  • RFC 2992 – Analysis of an Equal-Cost Multi-Path Algorithm
  • RFC 2328 – OSPF Version 2

Read on

Found a mistake or have an idea? Source of this page on GitHub.