cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1343
Views
5
Helpful
12
Replies

BGP load balancing

Mr.Kumar
Level 1
Level 1

Hello Everyone,

We are having 2 neighbors on BGP with different ASNs on each neighbor. Is it possible to load balance the traffic on 2 neighbors? If yes what configuration will help to do the same. And also not seeing any traffic on second neighbor due to the Age factor of the neighbor(recently changed ASN on one of the neighbor) Following is the current BGP config. TIA

router bgp 46732
bgp log-neighbor-changes
neighbor 66.xx.xx.193 remote-as 22xxx
neighbor 66.xx.xx.193 description Provider A
neighbor 66.xx.xx.197 remote-as 12xxx
neighbor 66.xx.xx.197 description Provider B
!
address-family ipv4
network 67.xx.xx.xx mask 255.255.255.0
network 198.245.240.176 mask 255.255.255.240
neighbor 66.xx.xx.193 activate
neighbor 66.xx.xx.193 soft-reconfiguration inbound
neighbor 66.xx.xx.193 route-map FROM_22xxx in
neighbor 66.xx.xx.193 route-map TO_22xxx out
neighbor 66.xx.xx.197 activate
neighbor 66.xx.xx.197 soft-reconfiguration inbound
neighbor 66.xx.xx.197 route-map FROM_12xxx in
neighbor 66.xx.xx.197 route-map TO_12xxx out
maximum-paths 2
exit-address-family

1 Accepted Solution

Accepted Solutions

Harold Ritter
Spotlight
Spotlight

Hi @Mr.Kumar ,

If you want to load balance between the default routes received from the two service providers, you need to add the following commands to you bgp configuration:

router bgp 46732

bgp bestpath as-path multipath-relax   <+++++ needed to ignore the fact that the paths come different ASNs

maximum-path 2 <++++++ needed to install both default routes in the RIB

Regards,

Regards,
Harold Ritter, CCIE #4168 (EI, SP)

View solution in original post

12 Replies 12

Hello,

One way to achieve your desired outcome it to configure the WEIGHT command. Assuming you're getting each route from both neighbors:

-Create a route map identifying half of the routes received from the neighbors (using a prefix list), then create a second route map identifying the other half of the routes.

-Make sure to include a separate permit statement in each route map to permit all other routes but no weight applied.

-Apply a weight to these routes (let's say 3000).

Apply one route-map IN to one neighbor and the other route-map on to the other neighbor.

 

Keep in mind this will load balance outbound traffic to those networks. It does not affect how your neighbors reach your netowrks.

 

Example:

ip prefix-list ONE halfOFroutes/prefix

ip prefix-list TWO halfOFroutes/prefix

 

route-map ONE permit 10

match ip address prefix-list ONE

weight 3000

route-map TWO permit 10

match ip address prefix-list TWO

weight 3000

route-map TWO permit 20

 

neighbor 66.xx.xx.197 route-map ONE in
neighbor 66.xx.xx.197 route-map TWO in

 

 

-David

Mr.Kumar
Level 1
Level 1

Hello David,

Firstly Thank you for your quick response. We are only getting one route on both the neighbors. Below is the prefix list and route map config.

 

Internet switch#sh run | sec route-map
neighbor 66.xx.xx.193 route-map FROM_22xxx in
neighbor 66.xx.xx.193 route-map TO_22xxx out
neighbor 66.xx.xx.197 route-map FROM_12xxx in
neighbor 66.xx.xx.197 route-map TO_12xxx out
route-map TO_12xxx permit 10
match ip address prefix-list TO_12xxx
route-map TO_22xxx permit 10
match ip address prefix-list TO_22xxx
route-map FROM_22xxx permit 10
match ip address prefix-list FROM_22xxx
route-map FROM_12xxx permit 10
match ip address prefix-list FROM_12xxx
Internet switch#sh run | i prefix-list
ip prefix-list FROM_12xxx seq 15 permit 0.0.0.0/0
ip prefix-list FROM_22xxx seq 15 permit 0.0.0.0/0
ip prefix-list FROM_3356 seq 5 permit 0.0.0.0/0
ip prefix-list TO_12xxx seq 30 permit xx.xx.105.0/24
ip prefix-list TO_22xxx seq 30 permit xx.xx.105.0/24
match ip address prefix-list TO_12xxx
match ip address prefix-list TO_22xxx
match ip address prefix-list FROM_22xxx
match ip address prefix-list FROM_12xxx

What are the possibilities in this case? TIA

BGP load balance.png

Harold Ritter
Spotlight
Spotlight

Hi @Mr.Kumar ,

If you want to load balance between the default routes received from the two service providers, you need to add the following commands to you bgp configuration:

router bgp 46732

bgp bestpath as-path multipath-relax   <+++++ needed to ignore the fact that the paths come different ASNs

maximum-path 2 <++++++ needed to install both default routes in the RIB

Regards,

Regards,
Harold Ritter, CCIE #4168 (EI, SP)

Hi Harold,

Thank you for the response, these command will restarts the BGP sessions right? Is there any other way that avoids the restart of  current BGP sessions? TIA

first check if the both AS path have same count of AS 
do
show ip bgp 0.0.0.0
check the AS 

MHM

Hi MHM,

Here is the output

Internet switch#show ip bgp 0.0.0.0
BGP routing table entry for 0.0.0.0/0, version 34
Paths: (2 available, best #2, table default)
Multipath: eBGP
Not advertised to any peer
Refresh Epoch 1
12xxx, (received & used)
66.xx.xx.197 from 66.xx.xx.197 (148.51.255.173)
Origin incomplete, localpref 100, valid, external
rx pathid: 0, tx pathid: 0
Refresh Epoch 1
22xxx, (received & used)
66.xx.xx.193 from 66.xx.xx.193 (148.51.255.172)
Origin incomplete, localpref 100, valid, external, best
rx pathid: 0, tx pathid: 0x0

Multipath: eBGP <<- you already have this
Not advertised to any peer
Refresh Epoch 1
12xxx, (received & used) <<- one AS count 
66.xx.xx.197 from 66.xx.xx.197 (148.51.255.173)
Origin incomplete, localpref 100, valid, external <<- this must be show multipath 
rx pathid: 0, tx pathid: 0
Refresh Epoch 1
22xxx, (received & used) <<- one AS count 
66.xx.xx.193 from 66.xx.xx.193 (148.51.255.172)
Origin incomplete, localpref 100, valid, external, best
rx pathid: 0, tx pathid: 0x0

 

I need to check why the router refuse to add second path as multipath 

MHM

 

 

Multipath: eBGP <<- you already have this
Not advertised to any peer
Refresh Epoch 1
12xxx, (received & used) <<- one AS count & different AS 
66.xx.xx.197 from 66.xx.xx.197 (148.51.255.173)
Origin incomplete, localpref 100, valid, external <<- this must be show multipath 
rx pathid: 0, tx pathid: 0
Refresh Epoch 1
22xxx, (received & used) <<- one AS count & different AS
66.xx.xx.193 from 66.xx.xx.193 (148.51.255.172)
Origin incomplete, localpref 100, valid, external, best
rx pathid: 0, tx pathid: 0x0

 

what you need additional as @Harold Ritter mention 

router bgp xxx

address family ipv4 unicast 

bgp bestpath as-path multipath-relax <<- 

 

GoodLuck 

MHM

Hi @Mr.Kumar ,

I do not think these commands will reset the session, but it is safer to implement these changes inside a maintenance window.

BTW, it is always a good idea to do a "clear bgp ipv4 uni * soft in" after you modify the inbound policy.

Regards,

Regards,
Harold Ritter, CCIE #4168 (EI, SP)

Mr.Kumar
Level 1
Level 1

Thanks to each and everyone, i have tested this last night and it worked perfectly.

You are so welcome 

MHM