It’s much better with Load Sharing — ECMP

Danesh Raj
3 min readNov 3, 2020

Equal-cost multipath or for short ECMP is a network routing strategy which load balance traffic and increase bandwidth bu fully utilizing unused bandwidth on links. The only catch here is the source and destination has to be the same. The usual in forwarding packets is where the routing technology decided which next-hop path to use by taking account packet header fields that identify a flow. Here’s where ECMP magic happens; next-hop paths of equal cost are identified based on routing metric calculations and hash algorithms. Then it identifies routers that has legitimate equal cost next hop to the destination. Based on the collected information an ECMP set is formed in the routing table containing multiple next-hop addresses to the same destination with equal cost.

Since ECMP plays well routing protocols the most used routing protocols are OSPF & BGP. Lets look at it ECMP in OSPFv2.

ECMP in OSPFv2

Firstly configure OSPF as you always do. Then configure ECMP by using maximum-paths (number of paths) to define the number of equal-cost paths the router should use. In the previous IOS version it has been set to 4. However in newer Cisco IOS Versions you can configure up to 32.

ECMP in OSPFv3

To configure ECMP when using IPV6 traffic; OSPFv3 is used. The fundamental OSPF & ECMP functionality still remains the same by defining ECMP using the maximum-paths command inside the OSPF process.

*Maximum-path values apply to each router individually & will need to be configured on each router in the network.

*Commands may vary between vendors.

ECMP in BGP

BGP also supports multi-path capabilities. One difference between the two is that BGP requires two commands to achieve this routing capability; one for eBGP and one for iBGP peerings.

Benefits of Per-Flow Load Balancing
• Incoming data traffic is evenly distributed over multiple equal-cost connections.
• Incoming data traffic is evenly distributed over multiple equal-cost connections member links within a bundle interface.

BGP Multipath load sharing iBGP and eBGP

Unlike most routing protocols, BGP only selects a single best path for each prefix. Configuring ECMP to work with BGP will allow it to share load via multipath iBGP & eBGP.

In order for BGP to use the second path, the following attributes have to match:

  • Weight
  • Local Preference
  • AS Path (both AS number and AS path length)
  • Origin code
  • MED
  • IGP metric

eBGP

When it comes to eBGP, there are two options:

  • Multiple paths to the same AS.
  • Multiple paths to different ASes.

Multiple paths to the same AS.

In this scenario R1 in AS 1 has 2 path to the same AS with 2 different destinations which is R2 & R3. As we are aware that ECMP must have the same equal cost path to the destination. Here both the path have equal costs but leads to different routers. This is usable in BGP where in some scenarios that requires traffic to be shared across the links.

Multiple paths to different ASes.

This example shows R1 from AS 1 wants to send information to Loopback 0 at R4 in AS 4. In order this to happen it will load share the packet via links R2 in AS 2 & R3 in AS 3. Since both of the next-hops are located in different AS, BGP will not allow load balance to take place. However it is possible by with some conditions which are the paths must have equal cost & require to run bgp bestpath as-path multipath-relax. This command relaxes the condition BGP have in place for ECMP. This will vary between other vendors.

ECMP is something that’s necessary in today’s networks. It provides a service that is absolutely required with the existence of multiple links and resilient routing designs. Understanding how it works and how to configure it is something that should be in every network engineers repertoire

--

--

Danesh Raj

I'm a Technology Enthusiast that passionate to help people live better by using Technology