Load Balancing across External BGP Paths

Modern BGP implementations usually forward traffic across equal-cost external BGP paths (Equal-Cost Multipath or ECMP). Unfortunately, the default definition of the equal-cost paths usually includes most BGP path attributes being equal, and many implementations provide nerd knobs you can use to fine-tune which BGP path attributes you want to ignore when considering ECMP paths.

In this lab exercise, you’ll observe simple EBGP ECMP across parallel paths toward AS 651000 (P1 and P2) and try to configure your router to forward traffic across all paths toward AS 65001 (P1, P2, and P3).

Lab topology


ECMP traffic forwarding across multiple autonomous systems is usually not a good idea, as you need to know each autonomous system’s internal structure and end-to-end delay. Still, you might have to configure multi-AS ECMP in environments that replaced IGP with EBGP.

Existing BGP Configuration

The routers in your lab use the following BGP AS numbers. C2 and P1 advertise an IPv4 prefix.

Node/ASN Router ID Advertised prefixes

Your router has these EBGP neighbors. netlab configures them automatically; if you’re using another lab infrastructure, you’ll have to configure them manually.

Node Router ID /
Router AS/
Neighbor AS
Neighbor IPv4
rtr 65000
p1 65100
p2 65100
p3 65101

Start the Lab

Assuming you already set up your lab infrastructure:

  • Change directory to lb/1-ebgp
  • Execute netlab up (device requirements)
  • Log into your router (RTR) with netlab connect rtr and verify that the IP addresses and the EBGP sessions are properly configured.

Configuration Tasks

Most BGP implementations have nerd knobs that change the EBGP load-balancing behavior:

  • Configure load balancing across EBGP paths using a command similar to maximum-paths. Allow EBGP load balancing across at least four parallel paths.
  • Configure your device to ignore AS path contents when searching for equal-cost paths. The command to use could start with bgp bestpath.


Default values differ across vendors; your device might already be doing what we want it to do. If your device’s default settings result in EBGP ECMP across multiple autonomous systems, try to find the configuration commands that would disable that behavior.


Log into your device and inspect its BGP table. The BGP table should contain two equal-cost paths to and three paths with equal AS-path length to

Some BGP implementations show the ECMP status of alternate paths in the BGP table printout. For example, this is the printout from an Arista EOS device:

rtr#show ip bgp
BGP routing table information for VRF default
Router identifier, local AS number 65000
Route status codes: s - suppressed contributor, * - valid, > - active, E - ECMP head, e - ECMP
                    S - Stale, c - Contributing to ECMP, b - backup, L - labeled-unicast
                    % - Pending best path selection
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI Origin Validation codes: V - valid, I - invalid, U - unknown
AS Path Attributes: Or-ID - Originator ID, C-LST - Cluster List, LL Nexthop - Link Local Nexthop

          Network                Next Hop              Metric  AIGP       LocPref Weight  Path
 * >Ec                0       -          100     0       65100 i
 *  ec                0       -          100     0       65100 i
 * >Ec                0       -          100     0       65100 65001 i
 *  ec                0       -          100     0       65100 65001 i
 *  ec                0       -          100     0       65101 65001 i

If your device does not provide that information, look into the IP routing table. It should contain two entries for and three entries for For example, these are the BGP entries in the IP routing table on a Cumulus Linux device:

rtr# show ip route bgp
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued, r - rejected, b - backup
       t - trapped, o - offload failure
B>* [20/0] via, swp1, weight 1, 00:00:08
  *                    via, swp2, weight 1, 00:00:08
B>* [20/0] via, swp1, weight 1, 00:00:08
  *                    via, swp2, weight 1, 00:00:08
  *                    via, swp3, weight 1, 00:00:08

Reference Information

The following information might help you if you plan to build custom lab infrastructure:

Device Requirements

Lab Wiring

Origin Device Origin Port Destination Device Destination Port
rtr Ethernet1 p1 swp1
rtr Ethernet2 p2 swp1
rtr Ethernet3 p3 swp1
p1 swp2 p2 swp2
p2 swp3 c2 swp1
p3 swp2 c2 swp2

Lab Addressing

Node/Interface IPv4 Address IPv6 Address Description
rtr Loopback
Ethernet1 rtr -> p1
Ethernet2 rtr -> p2
Ethernet3 rtr -> p3
c2 Loopback
swp1 c2 -> p2
swp2 c2 -> p3
p1 Loopback
swp1 p1 -> rtr
swp2 p1 -> p2
p2 Loopback
swp1 p2 -> rtr
swp2 p2 -> p1
swp3 p2 -> c2
p3 Loopback
swp1 p3 -> rtr
swp2 p3 -> c2