cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
5592
Views
0
Helpful
10
Replies

bgp multipath load balancing

Hello;

I want to share with you an issue I have related to bgp multipath load balancing.

My routeur have 3 path BGP with the same AS hop (different AS number but same AS hop - 3 hops to reach destination) to reach one destination, multipath-relax is enable and we want to install into the routing table 2 active routes and load balancing accross those links, the last link will be reserved as backup in case of one of active link is down.

Below is the config.

router bgp xxxx
 bgp log-neighbor-changes
 bgp bestpath as-path multipath-relax
 maximum-paths 2

this is working but the issue is, I'm not able to choose between all these 3 bgp path which routes to insert into my routing table.

Is there anyone who already face this problem ? can you tell me how to influence routing choice in this case.

Thank you for your reply.

10 Replies 10

Julio E. Moisa
VIP Alumni
VIP Alumni

Hi

Please correct me if I understand wrong, but you would like to force the traffic to select one path as the best, right?

If it is the case, you could configure local preference with greater value than the others and this way will help you to assign the primary path, secondary path and third path for entire traffic, no loadbalance: 

for example:

route-map LP-ISP1 permit 5
set local preferencen 10000

route-map LP-ISP2 permit 5
set local preferencen 5000

route-map LP-ISP3 permit 5
set local preferencen 2500

router bgp 100
neighbor 1.1.1.1 remote 1
neighbor 1.1.1.1 route-map LP-ISP1 in

neighbor 2.2.2.2 remote 2
neighbor 2.2.2.2. route-map LP-ISP2 in

neighbor 3.3.3.3 remote 3
neighbor 3.3.3.3 route-map LP-ISP3 in

clear ip bgp * soft. 

sh ip bgp 
sh ip bgp <received prefix>

Hop it is useful  :-)




>> Marcar como útil o contestado, si la respuesta resolvió la duda, esto ayuda a futuras consultas de otros miembros de la comunidad. <<

hello;

Thanks for your answer.

I think, I'm not making you understanding, see below some explaintion :

- I have three possibility to reach 10.81.1.0

router#sh ip bgp
BGP table version is 4, local router ID is 172.26.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network            Next Hop            Metric LocPrf Weight Path
*  10.81.1.0/24     10.255.252.2                                        64500 64512 64512 i
*>                        10.255.252.254                                    64500 64512 64512 i
*                          10.0.0.1                                               64514 39405 64512 i

- In my bgp config, I have:

router bgp 64513
 bgp log-neighbor-changes
 bgp bestpath as-path multipath-relax
 maximum-paths 2

with this I'm able to install two routes into my routing table

fsn00480# sh ip route
Codes: 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

Gateway of last resort is not set

B       10.81.1.0/24 [20/0] via 10.255.252.254, 02:07:32
                             [20/0] via 10.255.252.2, 02:07:32

Then I can load sharing traffic, and this is work fine. note that I have a other route left in case of one active routes goes down, I will still have two routes into my routing table:

in case of failure one active route, this is how the routing table will look.

fsn00480# sh ip route
Codes: 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

Gateway of last resort is not set

B       10.81.1.0/24 [20/0] via 10.255.252.254, 02:07:32
                             [20/0] via 10.0.0.1, 02:07:32

Came now my problem. I want to influence the way router is choosing those two routes to be installed into the routing table.

for instance, I want always these routes when all my three links are UP

B       10.81.1.0/24 [20/0] via 10.255.252.254, 02:07:32
                             [20/0] via 10.0.0.1, 02:07:32

then in case of one active link fail, I want to have this:

B       10.81.1.0/24 [20/0] via 10.255.252.254, 02:07:32
                             [20/0] via 10.255.252.2, 02:07:32

And once the link that was failed come back to UP, I want my routing table go back to previous state, means:

B       10.81.1.0/24 [20/0] via 10.255.252.254, 02:07:32
                             [20/0] via 10.0.0.1, 02:07:32

thank you for your help.

Best regards;

Hello,

"If more candidates exist than that called for with the maximum-paths command, the
tiebreakers of Steps 10 and 11 determine the ones to use"

You need to play with :

10: Lowest BGP Router ID of Advertising Router

11: Lowest Neighbor ID

In order to use maximum-path, routes must be equal (Weight, Local preference, As path length, Med and so on)

Also consider this:

"Only eBGP routes whose adjacent ASNs are the same ASN as the best route are considered as candidates"

Hope it helps,

Masoud

hello;

Thanks again for your answer, I remark for my case the choice is very random, the lowest ID neighbors or router ID is not matching.

Is there any way that I can manage for myself to force router in this case to choose my prefer routes among those three and guarantee also failover as explain into my previous post.

thanks for your support.

The solution is easy. Am I missing something?

You can add the same weight to those two neighbors you want to load balance across.

Neighbor R1 weight 200

Neighbor R3 weight 200

Neighbor R2 will have the weight of 0 so your router will always load balance across R1 and R3.

Hope it helps,

Masoud

I read your previous post more carefully. You want the third router's routes to be installed into the routing table in case of link failure.

I believe the choice based on lowest ID neighbors or router ID is not random. I just tested it. The routes from the failed router sit in the routing table after the failed router comes up.

Masoud

Hello Masoud;

I can confirm now your point of view, when you said "I believe the choice based on lowest ID neighbors or router ID is not random"

I used bgp router id to influence how router will choose routes, so the lowest router id is prefered.

But I have not well understand very well, when you said "The routes from the failed router sit in the routing table after the failed router comes up"

do this means, my routing table will not go back as previous when one failed router will come back, even if we indicate to the router to compare bgp router id ?

Thanks for your reply

Hello,

I meant your routing table will go back when the failed router comes back. As I said, when  the failed router comes up, routing table will be updated based on the lowest router-id.

I hope it is clear now.

Masoud

Hello
Try applying MED incoming of preferred peers, Doing so should give you the two multipaths you wish.

route-map STAN
set metric 100

router bgp 64153
bgp bestpath med missing-as-worst
bgp bestpath as-path multipath-relax
maximum-paths 2
neighbor 10.0.0.1 route-map STAN in

clear ip bgp * soft

If you dont wish to apply med missing-as-worst command then use the route map to assign to each neighbor a metric of your preference

res
Paul


Please rate and mark as an accepted solution if you have found any of the information provided useful.
This then could assist others on these forums to find a valuable answer and broadens the community’s global network.

Kind Regards
Paul

Joseph W. Doherty
Hall of Fame
Hall of Fame

You're looking to chose a specific pair of primary links vs. a backup, correct?  Also for both ingress and egress?

Looking at what you've posted, two links are "randomly" selected for egress and just one or three are used for ingress?

If your devices support embedded scripts, I'm sure you can change you config on-the-fly, after one of the primary links fail, to enable the backup link.  I.e. the backup link might have a policy to avoid using it, but when there's failure of one of the primary links, the script might change BGP policy on the backup link so it would then be actively used.  If the original failed link recovers, an embedded script could cause the backup link to stopped being used again.

PfR might also be able to support your requirement, although I'm unsure about that.

Something other than a script might also be possible with object tracking and/or conditional route injection.