Maximum-Paths
Scenario to verify BGP maximum-paths functionality for ECMP (Equal-Cost Multi-Path) load balancing with eBGP sessions.
ECMP allows BGP to install multiple equal-cost paths in the routing table for the
same destination, enabling traffic load balancing across multiple next-hops. By
default, BGP selects only a single best path. The maximum-paths ebgp <N>
command sets the maximum number of eBGP paths for ECMP, requiring multiple eBGP
neighbors advertising the same prefix.
The test uses a topology with DUT0 receiving the same route
(192.168.10.0/24) from two eBGP peers (DUT1 and DUT2). Initially
configured with maximum-paths ebgp 1, only one path is installed. After
changing to maximum-paths ebgp 2, both paths are installed in the routing
table for ECMP load balancing.
Test BGP Maximum Paths
Description
Test BGP maximum-paths eBGP for ECMP: initially with 1 path only one route is installed, after changing to 2 both paths are installed for load balancing.
Scenario
Step 1: Set the following configuration in DUT0 :
set interfaces ethernet eth0 address 10.10.0.100/24 set interfaces ethernet eth1 address 20.20.0.100/24 set protocols bgp 100 maximum-paths ebgp 1 set protocols bgp 100 neighbor peer1 remote-address 10.10.0.201 set protocols bgp 100 neighbor peer1 remote-as 200 set protocols bgp 100 neighbor peer1 route-map import PERMIT set protocols bgp 100 neighbor peer2 remote-address 20.20.0.202 set protocols bgp 100 neighbor peer2 remote-as 200 set protocols bgp 100 neighbor peer2 route-map import PERMIT set protocols route-map PERMIT rule 1 action permit set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
Step 2: Set the following configuration in DUT1 :
set interfaces dummy dum0 address 192.168.10.1/24 set interfaces ethernet eth0 address 10.10.0.201/24 set protocols bgp 200 neighbor peer remote-address 10.10.0.100 set protocols bgp 200 neighbor peer remote-as 100 set protocols bgp 200 neighbor peer route-map export PERMIT set protocols bgp 200 redistribute connected route-map REDIS set protocols route-map PERMIT rule 1 action permit set protocols route-map REDIS rule 1 action permit set protocols route-map REDIS rule 1 match interface dum0 set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
Step 3: Set the following configuration in DUT2 :
set interfaces dummy dum0 address 192.168.10.1/24 set interfaces ethernet eth0 address 20.20.0.202/24 set protocols bgp 200 neighbor peer remote-address 20.20.0.100 set protocols bgp 200 neighbor peer remote-as 100 set protocols bgp 200 neighbor peer route-map export PERMIT set protocols bgp 200 redistribute connected route-map REDIS set protocols route-map PERMIT rule 1 action permit set protocols route-map REDIS rule 1 action permit set protocols route-map REDIS rule 1 match interface dum0 set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
Attention
Verify that both BGP sessions are established.
Step 4: Run command protocols bgp show ip summary at DUT0 and check if output matches the following regular expressions:
10.10.0.201.*Established[\s\S]+20.20.0.202.*EstablishedShow output
IPv4 Unicast Summary: BGP router identifier 20.20.0.100, local AS number 100 VRF default vrf-id 0 BGP table version 1 RIB entries 1, using 128 bytes of memory Peers 2, using 47 KiB of memory Neighbor LocalAddr V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State PfxRcd PfxSnt Desc 10.10.0.201 10.10.0.100 4 200 5 5 1 0 0 00:00:01 Established 1 (Policy) N/A 20.20.0.202 20.20.0.100 4 200 2 2 0 0 0 00:00:00 Established 0 (Policy) N/A Total number of neighbors 2
Attention
Verify that DUT0 receives route 192.168.10.0/24 from both neighbors.
Step 5: Run command protocols bgp show ip at DUT0 and check if output matches the following regular expressions:
[*]>\s+192.168.10.0/24Show output
BGP table version is 1, local router ID is 20.20.0.100, vrf id 0 Default local pref 100, local AS 100 local address - Status codes: s suppressed, d damped, h history, u unsorted, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete RPKI validation codes: V valid, I invalid, N Not found Network Next Hop Metric LocPrf Weight Path *> 192.168.10.0/24 10.10.0.201 0 0 200 ? Displayed 1 routes and 1 total paths
Step 6: Run command protocols ip show route at DUT0 and check if output matches the following regular expressions:
B>[*]\s+192.168.10.0/24Show output
Codes: K - kernel route, C - connected, L - local, S - static, R - RIP, O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP, T - Table, v - VNC, V - VNC-Direct, A - Babel, F - PBR, f - OpenFabric, t - Table-Direct, > - selected route, * - FIB route, q - queued, r - rejected, b - backup t - trapped, o - offload failure IPv4 unicast VRF default: C>* 10.10.0.0/24 is directly connected, eth0, weight 1, 00:00:04 K * 10.10.0.0/24 [0/0] is directly connected, eth0, weight 1, 00:00:04 L>* 10.10.0.100/32 is directly connected, eth0, weight 1, 00:00:04 C>* 20.20.0.0/24 is directly connected, eth1, weight 1, 00:00:04 K * 20.20.0.0/24 [0/0] is directly connected, eth1, weight 1, 00:00:04 L>* 20.20.0.100/32 is directly connected, eth1, weight 1, 00:00:04 B>* 192.168.10.0/24 [20/0] via 10.10.0.201, eth0, weight 1, 00:00:01
Note
With maximum-paths ebgp 1 configured, only one path is installed.
Step 7: Run command protocols ip show route 192.168.10.0/24 at DUT0 and check if output does not match the following regular expressions:
(10.10.0.201[\s\S]+20.20.0.202|20.20.0.202[\s\S]+10.10.0.201)Show output
Routing entry for 192.168.10.0/24 Known via "bgp", distance 20, metric 0, best Last update 00:00:01 ago * 10.10.0.201, via eth0, weight 1
Note
Configure maximum-paths ebgp 2 to enable ECMP.
Step 8: Modify the following configuration lines in DUT0 :
set protocols bgp 100 maximum-paths ebgp 2
Attention
Verify that both routes are now installed (ECMP active) with both next-hops visible.
Step 9: Run command protocols ip show route 192.168.10.0/24 at DUT0 and check if output matches the following regular expressions:
10.10.0.201[\s\S]+20.20.0.202Show output
Routing entry for 192.168.10.0/24 Known via "bgp", distance 20, metric 0, best Last update 00:00:00 ago * 10.10.0.201, via eth0, weight 1 * 20.20.0.202, via eth1, weight 1