Table of Contents
BGP Multipath AS-Path Relax is a feature in BGP that allows multiple paths (to the same destination) with different AS paths to be considered for ECMP (Equal-Cost Multi-Path) routing, as long as the AS path length is the same.
In the previous post we discussed the BGP multipath scenario and learnt how to configure the same. However, in the last post router installed two parallel paths in the routing table from BGP as all the below parameters were matching on the two paths.
- Weight
- Local Preference
- AS Path (both AS number and AS path length)
- Origin code
- MED
- IGP metric
BGP Multipath As-Path Relax
But what happens if the CE is dual-homed to two different service providers and both the service providers are using different AS. In that case, the two parallel paths won’t be the same as the AS path number would be different. In such a case to install two parallel paths from BGP in the routing table we have to use the BGP feature “bgp multipath as-path relax”.
Network Topology
Let us use the below topology to configure the same:

On R1 we have two EBGP neighbors to two different AS. R1 has two parallel paths to reach 4.4.4.4 i.e. R1>R2>R4 & R1>R3>R4. By default, BGP will keep a single path to reach 4.4.4.4 on R1. The normal multipath command would also not work here as AS numbers of R2 and R3 are different.
Related – BGP AS Override
Configuration
Let us have a look at the configurations:
Currently, on R1 we have the below configurations where we are still using the maximum path command under BGP. Since now the AS numbers are different for R2 and R3 we are seeing only a single best route in BGP table and also a single route in the routing table.
R1#sh runn | s r bgp
router bgp 100
bgp log-neighbor-changes
neighbor 9.9.12.2 remote-as 200
neighbor 9.9.13.3 remote-as 300
maximum-paths 2
R1#sh ip route
Codes: L – local, C – connected, S – static, R – RIP, M – mobile, B – BGP
D – EIGRP, EX – EIGRP external, O – OSPF, IA – OSPF inter area
N1 – OSPF NSSA external type 1, N2 – OSPF NSSA external type 2
E1 – OSPF external type 1, E2 – OSPF external type 2
i – IS-IS, su – IS-IS summary, L1 – IS-IS level-1, L2 – IS-IS level-2
ia – IS-IS inter area, * – candidate default, U – per-user static route
o – ODR, P – periodic downloaded static route, H – NHRP, l – LISP
+ – replicated route, % – next hop override
Gateway of last resort is not set
1.0.0.0/32 is subnetted, 1 subnets
C 1.1.1.1 is directly connected, Loopback0
4.0.0.0/32 is subnetted, 1 subnets
B 4.4.4.4 [20/0] via 9.9.12.2, 00:03:40
9.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
C 9.9.12.0/24 is directly connected, FastEthernet0/0
L 9.9.12.1/32 is directly connected, FastEthernet0/0
C 9.9.13.0/24 is directly connected, FastEthernet1/0
L 9.9.13.1/32 is directly connected, FastEthernet1/0
R1#sh ip bgp
BGP table version is 2, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i – internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
Origin codes: i – IGP, e – EGP, ? – incomplete
RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
* 4.4.4.4/32 9.9.13.3 0 300 400 i
*> 9.9.12.2 0 200 400 I ####Single Best Route#####
Now let us configure the as-path relax on R1 and check the BGP and routing table again.
R1(config)#router bgp 100
R1(config-router)#bgp bestpath as-path multipath-relax
## Please note this command is a hidden command and not visible if you do a “?” for help.
Now let us check the routing table and BGP table again on R1 and we will be able to see both the parallel paths i.e. From R2 and R3 installed.
R1#sh ip route
Codes: L – local, C – connected, S – static, R – RIP, M – mobile, B – BGP
D – EIGRP, EX – EIGRP external, O – OSPF, IA – OSPF inter area
N1 – OSPF NSSA external type 1, N2 – OSPF NSSA external type 2
E1 – OSPF external type 1, E2 – OSPF external type 2
i – IS-IS, su – IS-IS summary, L1 – IS-IS level-1, L2 – IS-IS level-2
ia – IS-IS inter area, * – candidate default, U – per-user static route
o – ODR, P – periodic downloaded static route, H – NHRP, l – LISP
+ – replicated route, % – next hop override
Gateway of last resort is not set
1.0.0.0/32 is subnetted, 1 subnets
C 1.1.1.1 is directly connected, Loopback0
4.0.0.0/32 is subnetted, 1 subnets
B 4.4.4.4 [20/0] via 9.9.13.3, 00:02:43
[20/0] via 9.9.12.2, 00:02:43
9.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
C 9.9.12.0/24 is directly connected, FastEthernet0/0
L 9.9.12.1/32 is directly connected, FastEthernet0/0
C 9.9.13.0/24 is directly connected, FastEthernet1/0
L 9.9.13.1/32 is directly connected, FastEthernet1/0
R1#sh ip bgp
BGP table version is 3, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i – internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
Origin codes: i – IGP, e – EGP, ? – incomplete
RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
*m 4.4.4.4/32 9.9.13.3 0 300 400 i
*> 9.9.12.2 0 200 400 i
Related – BGP Interview Questions
ABOUT THE AUTHOR

You can learn more about her on her linkedin profile – Rashmi Bhardwaj