BGP Multipath - by default, BGP installs only a single path in IBGP and EBGP deployment. If prefixes are learned via multiple paths, BGP supports multipath for IBGP, EBGP, or across both IBGP and EBGP via the EIBGP Multipath feature. In this blog post, we will explore each of these options: IBGP Multipath, EBGP Multipath, and EIBGP Multipath.
First of all, we should know that the BGP Multipath feature should be enabled manually on the network device, unlike IGP protocols.
In IGP protocols, when there is Multipath, commonly referred to as ECMP (Equal Cost Multipath), routers install all next-hops for the destination prefixes to the routing and forwarding table automatically, without manual human operation.
We have on the website the most detailed, design and practical hands-on BGP Training in the world.
Let's start with the first one, EBGP Multipath:
EBGP Multipath
Figure - EBGP Multipath
We have two rules for EBGP Multipath:
- For the destination prefix, if there is more than one path, the total number of AS - Autonomous System - should be the same across the different paths.
- For the destination prefix, if there is more than one path, the same AS numbers should be in the AS Path.
In the above figure, since from AS 100 to the destination prefix 192.168.0.0/24 there are two paths and both have 2 AS-Path lengths, Rule 1 is satisfied.
Also, the AS numbers are the same towards the destination prefix, which is AS 100 - AS 200, and finally the destination.
Let's have a look now at IBGP Multipath:
IBGP Multipath
Figure - IBGP Multipath
For IBGP Multipath, all the other best path selection steps until the Multipath tie-breaker should be the same.
Local Preference, AS-Path Length, Origin, MED - all should be the same. In fact, the IGP cost to the BGP next-hop has to be the same as well.
Then, IBGP Multipath can be enabled manually, and for the destination prefix, both BGP next-hops can be used.
Lastly, let's have a look at EIBGP Multipath:
EIBGP Multipath
Figure - EIBGP Multipath
The BGP best path selection algorithm prefers EBGP paths over IBGP paths.
This prevents having both IBGP and EBGP prefixes installed in the routing table at the same time.
The EIBGP Multipath feature allows the same prefix to be installed both with IBGP and EBGP next hops.
Configuring BGP Multipath on Cisco Routers
After explaining IBGP Multipath, EBGP Multipath, and EIBGP Multipath, let's have a look at a BGP Multipath configuration example on Cisco devices:
Router(config-router)# maximum-paths ibgp maximum-numberThis command controls the maximum number of parallel IBGP routes that can be installed in a routing table.
BGP Bestpath AS-Path Multipath-Relax
So what happens if the AS numbers are different across the paths? Let's remember the two EBGP Multipath rules again: the number of ASes has to be the same across the paths, and the AS numbers in the AS Paths have to be the same as well.
Figure - Multipath-Relax Feature
In the above figure, the number of ASes in both of the paths is 2, but the AS numbers are different.
One of the paths is AS 100 - AS 400, and the other path is AS 100 - AS 300.
Thus, across two different paths, as we have different AS numbers - although you have 2 ASes in both of these paths - you cannot do EBGP Multipath by default.
If you want to enable EBGP Multipath even if you have different AS numbers, then you need the bgp bestpath as-path multipath-relax configuration command. With this, basically, you are telling the routers: even if the AS numbers are different across the paths, if the AS Path length is the same, then behave a little bit relaxed and allow EBGP Multipath.
Bonus: this feature is used in CLOS topologies in Hyperscale Datacenters today, and you can find more information about it in RFC 7938.
BGP Load Balancing and BGP ECMP
In this post so far, I have been explaining BGP Multipath for the IBGP Multipath, EBGP Multipath, and EIBGP Multipath features and their usage. Sometimes, network engineers use the BGP Load Balancing or BGP ECMP terms instead of BGP Multipathing. They all are the same thing.
In BGP, we usually don't use the BGP ECMP, BGP Load Balancing, or BGP Load Sharing terms, but we use the BGP Multipath keyword mostly. By highlighting this, I wanted to avoid any future confusion for you.
We have many other BGP posts on the website and we have 35-40 hours of video-based BGP Course on the website.
