JNCIE-SP, BGP, Multi-path relax

by default no load balancing.

if the multipath is enabled, only bgp routes from the same AS neighbor will be load balanced.

if the routes travers several different AS, even the AS path length is same, it will not be load balance.

so the bgp multi-path relax will be used.

More information:
From:
http://blog.alwaysthenetwork.com/tutorials/bgp-multipath-relax/

BGP Multipath-Relax

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:
BGP-Multipath-Relax-Topology-1.jpg
(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:
BGP-Multipath-Relax-Topology-2.jpg
(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.

For Juniper:
Enable the BGP group to use multiple paths.

Note: To disable the default check requiring that paths accepted by BGP multipath must have the same neighboring autonomous system (AS), include the multiple-as option.

[edit protocols bgp group external]user@R1# set multipath

Advertisements
  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: