Showing results for 
Search instead for 
Did you mean: 

BGP with 2 ISP with automatic failover and load balancing

Sameer Vashisth
Level 1
Level 1

We need to configure BGP with 2 ISP on Single Router, with load balancing and failover. The current configuration is providing load balancing but if ISP1 link goes down, then browsing stops but if ISP2 goes down then we are able to browse. We have added 2 default routes for both ISP. The network diagram is attached.


Our BGP configuration is:

router bgp ZZZZZ

 no synchronization

 bgp log-neighbor-changes

 network mask

 redistribute static

 neighbor remote-as XXXXX

 neighbor soft-reconfiguration inbound

 neighbor remote-as YYYYY

 neighbor soft-reconfiguration inbound

 no auto-summary


ip route

ip route




5 Replies 5


ip as-path access-list 1 permit ^$

route-map AS permit 10
 set as-path prepend ZZZ ZZZ ZZZ

route-map AS permit 99


router bgp zzz
 neighbor remote-as XXXX
 neighbor weight 40000 (most preffered outbound traffic)
 neighbor filter-list 1 out ( prohibits transit traffic betwen ISPs)

neighbor remote-as YYYY
neighbor weight 30000
neighbor filter-list 1 out ( prohibits transit traffic betwen ISPs)
neighbor route-map AS out ( upstream from ISP2 see a less prefferd to reach AS111 via ISP2)






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

Hi Sameer, 

as you would like to setup a load sharing scenario with automatic failover, I would like to ask you a couple of questions:

Are you getting full, partial or default routes from the ISPs ?

What kind of providers are ISP-1 and ISP-2 ? Tier-1, Tier-2..? as you are advertising the same prefix /24 to both providers, the load sharing ratio will depend on the "positioning" of the ISP´s in Internet, so you must take this into account and you might need to manipulate the BGP attributes of the prefix you are advertising in order to get a better utilization of the links.

You said that "current configuration is providing load balancing", but in your configuration I do not see any manipulation to achieve this:

- Outbound path selection: the router will install the routes of one ISP in the RIB and therefore there is going to be just one exit point, unless the other fails. 

You could achieve load sharing with the solution that Tagir proposes with "maximum-paths 2" but I am afraid this will not work as the prefixes you are receiving from both ISP´s are coming from different ASNs. For this to work you, should configure "bgp bestpath as-path multipath-relax"  in addition to "maximum-paths" ,assuming you´re getting the same prefixes from both providers.

- Inbound path selection: here you need to know the ISP´s positioning in Internet and then, maybe, play with prepending. 

I agree with Paul´s proposal of using the AS-PATH filter to avoid using your AS as transit.

Hope this helps,



"maximum-paths 2" 

the router will install two default routes

and it will use two routes for upstream


u can check every step

sh ip bgp

sh int

and ask your providers do u need to filter upstream updates. usually they do. because nobody wants problems



Hi Jose,

Both our ISP's are providing default routes only, and both are Tier -1 ISP. 

Tagir Temirgaliyev

for upstream load-balancing u need

router bgp ZZZZZ

 neighbor remote-as XXXX
 neighbor weight 30000
neighbor remote-as YYYY
neighbor weight 30000

maximum-paths 2


please provide

sh ip bgp

sh ip route

sh bgp nei

and ask your providers do u need to filter upstream updates. usually they do.

Review Cisco Networking for a $25 gift card