Index
What is Equal Cost Multi Path (ECMP)?
Configuration Syntax
Example
Goal
Topology
Sample Configuration
Equal Cost Multi Path (ECMP) is a Layer 3 routing strategy to forward traffic to a destination using multiple available paths. ECMP increases the number of paths to a destination and increases the available bandwidth to reach the destination. The ECMP mechanism enables load balancing and increased bandwidth by using unused links and bandwidth.
ECMP hashing
Different hashing seeds are required in different tiers to prevent traffic polarization in tree-sized data center network topology. In SONiC, we use distinct hashing algorithms for ECMP and LAG by default, so configuring the hash seed is all that is required.
Although ECMP can increase the number of available links, all available paths should be closely load-shared so that no path is over or underutilized. You can modify the IP ECMP load-share hashing parameters to affect traffic load-sharing across multiple available paths. To obtain optimal ECMP load sharing, configure ECMP in all devices that reside between the source and the destination.
It is a best practice to configure different load-balancing parameters at each tier-based upon the unique traffic pattern in the network, if needed. For example, on Router A, the hash fields for load balancing could include source-ip, dest-ip, protocol, source-port, and L4-dest-port, while on Router B, the hash fields could use only source-ip, dest-ip, and protocol.
Configure the ECMP hash seed.
Configure a unique hash seed for each device to avoid hash polarization which may result in network congestion. Network polarization can happen when multiple data flows try to reach a switch using the same switch ports.
Configuration Syntax |
Explanation |
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure
DELLSONiC(config)# ip load-share hash { seed-value }
|
Configure the hash seed. The value for seed-value is from 0 to 16777215. |
Activating multipath in BGP Configuration
Configuration Syntax |
Explanation |
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure
DELLSONiC(config)# router bgp {as-number}
DELLSONiC (conf-router-bgp)# address-family {ipv4 unicast | ipv6 unicast}
DELLSONiC (conf-router-bgp-af)# maximum-paths {number}
|
Configure the maximum number of eBGP routes that can be selected to form equal cost multi-path (ECMP) routes for load-sharing. |
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure
DELLSONiC(config)# router bgp {as-number}
DELLSONiC (conf-router-bgp)# address-family {ipv4 unicast | ipv6 unicast}
DELLSONiC (conf-router-bgp-af)# maximum-paths ibgp {number} |
Configure the maximum number of iBGP routes that can be selected to form equal cost multi-path (ECMP) routes for load-sharing. |
Configure ECMP load-share hash for IPv4 (Optional).
Configuration Syntax |
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure
DELLSONiC(config)# ip load-share hash ipv4 {ipv4-src-ip | ipv4-dst-ip | ipv4-ip-proto | ipv4-l4-src-port| ipv4-l4-dst-port | symmetric}
|
Configure ECMP load-share hash for IPv6 (Optional).
Configuration Syntax |
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure
DELLSONiC(config)# ip load-share hash ipv6 {ipv6-src-ip | ipv6-dst-ip | ipv6-next-hdr | ipv6-l4-src-port| ipv6-l4-dst-port | symmetric}
|
Consider the Dell SONiC switch has two routes from BGP to reach 4.4.4.4/32 routes. We must use ECMP to reach 4.4.4.4/32 and use both routes simultaneously.
We can view the path advertised by the BGP neighbors to our switch to reach a host or subnet, use command show bgp ipv4 unicast <host/subnet>. A sample output is shows below
DELLSONiC# show bgp ipv4 unicast 4.4.4.4
BGP routing table entry for 4.4.4.4/32
Paths: (2 available, best #2, table default)
200
10.0.0.2 from 10.0.0.2 (20.0.0.1)
Origin incomplete, metric 0, valid, external, multipath
Last update: 2023-12-25 14:34:55+0000
200
30.0.0.2 from 30.0.0.2 (30.0.0.2)
Origin incomplete, metric 0, valid, external, multipath, best (Older Path)
Last update: 2023-12-25 14:34:55+0000 |
|
Let us activate ECMP.
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure
DELLSONiC(config)# ip load-share hash seed 100
|
Let us Configure maximum BGP path to 2 as we have two paths.
admin@DELLSONiC:~$ sonic-cli
DELLSONiC# configure
DELLSONiC(config)# router bgp 100
DELLSONiC(config-router-bgp)# address-family ipv4 unicast
DELLSONiC(config-router-bgp-af)# maximum-paths 2 |
To verify if both routes are installed in the routing table, use the below command:
show ip route <hopst/subnet>
DELLSONiC# show ip route 4.4.4.4
Codes: K - kernel route, C - connected, S - static, B - BGP, O - OSPF
> - selected route, * - FIB route, q - queued route, r - rejected route
Destination Gateway Dist/Metric Last Update
--------------------------------------------------------------------------------------------------------------------------------
B>* 4.4.4.4/32 via 10.0.0.2 Eth1/1 20/0 03:02:41 ago
* via 30.0.0.2 Eth1/2
|