So I learned a new command today. As usual I want to share with everyone. Today’s command is “bgp bestpath as-path multipath-relax”, which is actually hidden in IOS.

To give some background, BGP will not load balance across multiple paths by default. We can configure it to do so with the “maximum-paths n” command, which is pretty well known. The criteria of this command is that all attributes must match (Weight, LP, AS Path, etc). This is acceptable if we are multihomed to a single AS, but what if we are multihomed to different ASes? In that case we are not able to load balance across theoretically equal paths. Enter the “bgp bestpath as-path multipath-relax” command…

Here’s our first topology:

(click for fullsize)

Now the config:

R1(config)#router bgp 100
R1(config-router)#no synchronization
R1(config-router)#neighbor 10.1.12.2 remote-as 200
R1(config-router)#neighbor 10.1.13.3 remote-as 200
R1(config-router)#no auto-summary

Here we see the basic BGP config on R1. We will only be configuring R1 in this post.

Let’s look at the BGP table and RIB.

R1#sh ip bgp
...
   Network          Next Hop            Metric LocPrf Weight Path
*  192.168.1.0      10.1.12.2                              0 200 400 i
*>                  10.1.13.3                              0 200 400 i
 
 
R1#sh ip route
...
     10.0.0.0/24 is subnetted, 2 subnets
C       10.1.13.0 is directly connected, Serial0/1
C       10.1.12.0 is directly connected, Serial0/0
B    192.168.1.0/24 [20/0] via 10.1.13.3, 00:01:16

We see that BGP has selected the path through R3 and put the router in its RIB.

Now we will configure BGP to use two paths, then we’ll verify:

R1(config)#router bgp 100
R1(config-router)#maximum-paths 2
 
R1#sh ip route
...
     10.0.0.0/24 is subnetted, 2 subnets
C       10.1.13.0 is directly connected, Serial0/1
C       10.1.12.0 is directly connected, Serial0/0
B    192.168.1.0/24 [20/0] via 10.1.13.3, 00:03:18
                    [20/0] via 10.1.12.2, 00:00:15

Simple command under the BGP process, we see that R1 is now equally load balancing across both paths.

Now we will change it up a bit.

Here’s our second topology:

(click for fullsize)

This time R2 and R3 are in separate ASes. Let’s try “maximum-paths” again and see what happens:

R1(config)#router bgp 100
R1(config-router)# maximum-paths 2
 
R1#sh ip bgp
...
   Network          Next Hop            Metric LocPrf Weight Path
*  192.168.1.0      10.1.13.3                              0 300 400 i
*>                  10.1.12.2                              0 200 400 i
 
R1#sh ip route
...
     10.0.0.0/24 is subnetted, 2 subnets
C       10.1.13.0 is directly connected, Serial0/1
C       10.1.12.0 is directly connected, Serial0/0
B    192.168.1.0/24 [20/0] via 10.1.12.2, 00:00:04

As expected we see that R1 is not load balancing because it does no see the paths as “equal” (different AS Paths).

This is where “bgp bestpath as-path multipath-relax” comes in:

R1(config)#router bgp 100
R1(config-router)#bgp bestpath as-path ?
% Unrecognized command
R1(config-router)#bgp bestpath as-path multipath-relax
R1(config-router)#
 
R1#sh run | sec bgp
router bgp 100
 bgp bestpath as-path multipath-relax
 neighbor 10.1.12.2 remote-as 200
 neighbor 10.1.13.3 remote-as 300
 maximum-paths 2
 
R1#sh ip route
...
     10.0.0.0/24 is subnetted, 2 subnets
C       10.1.13.0 is directly connected, Serial0/1
C       10.1.12.0 is directly connected, Serial0/0
B    192.168.1.0/24 [20/0] via 10.1.13.3, 00:00:16
                    [20/0] via 10.1.12.2, 00:00:16

And it works! Notice that the command doesn’t show up when we use the “?”. It is a hidden command. I’m not sure why at this point, just that it is. We do see it when we look at R1′s BGP config though.

That’s it for this one, just a short post on something new I learned today.

Colby

Colby Glass has been in IT since 2002. He is currently a Systems Engineer (presales) with a Cisco Gold partner and holds the CCNP R/S, CCNP DC, CCDP, CCIP, JNCIA-ER.

More Posts