Showing results for 
Search instead for 
Did you mean: 

how to create BGP application based failover and loadbalance


Hi Firends,

                  I just gote tired of googling about my issue and had got nothing yet so finally i decided to ask you all,

I have very complicated requirements in BGP which i had explained bellow

I have 12 locations including HO with two ISP running BGP and providing connectivity between sites to sites and sites to HO using MPLS.

Now i had tried to configure a failover sitution using the route map by incrising the prefrence of a particular neighbour AS, which worked fine

route-map LOCAL_PRE, permit, sequence 20
  Match clauses:
  Set clauses:
    local-preference 200
  Policy routing matches: 0 packets, 0 bytes

router bgp 65001
no synchronization
bgp log-neighbor-changes
network mask
neighbor remote-as 65500
neighbor route-map LOCAL_PRE in
neighbor filter-list 10 out
neighbor remote-as 18101
neighbor ebgp-multihop 5
neighbor soft-reconfiguration inbound
neighbor filter-list 10 out
no auto-summary

The Problem

I want to set certain parameters that if my primary links get down then after 10 to 20 RTO's it must failover to the secondry

now the problem hear is that i want to utlize both the link but in different manner for example

i want my SAP and internet traffic to pass from the secondry link

and FTP,VC etc traffic must pass from the primary link, if the primary links fails then all this appl, VC, Int and ftp must work on secondry link

So hear is the problem as i am unable to find any solutions to this problem 


Jayaprakash KC

Hello Sandeep

you will need to have a route-map that has an access list matching your traffic ( SAP etc) and selctivley tweak the LP and AS_PATH for achieving traffic control in both the inbound and outbound directions.


Chetan Kumar Ress

Hi Sandeep,

If your server are in different network then Simply you can play with Route-Map & Local Prep to achive your requriment.

Below is the senario :

Your Application :  --- Used for SAP etc

                         --- User For  VC etc

Configure Route-Map :

Route Map 1 seq 10

local prep 1000     ========= >  Used in link A

Route Map 1 seq 20

Route Map 2 seq 10

local prep 1000   ==========> Used in link B

Route Map 2 seq 20

* The Above are not exact command it is just an example to show how to confiure the route-map

And if your server are in same subnet then its an only suggesion i had not tried the same but can resolve the issue .

You can configure static route with /32 mask and point towards outgoing interface with specific server or application so insted to using BGP route it will use static route becasue of more specific prefix.

So if link fail then static route will remove from routing table & user BGP route to reach destination & Vice versa fo other link.

** If your link is MPLS Metro Ethernet then you need to configure IP SLA track to remove the route form routing table becasue you linterface never goes down.


Chetan Kumar

Message was edited by: Chetan Kumar Ress

Dear Chetan,

                   Thanks for your reply.

But i can't go for static route as i have 12 locations currently and more 10 are going addup in a year and then its going to inrease again, so i dont think that static route is going to be easy to maintain and moreover both the ISP's are also using BGP so i prefer to use BGP.

My servers are in the same subnet at HO and so your solution can't be work out but i had given me a hint

If i configure route map based on host based acl source as server from HO and destination as server ip from client then it may be possible am i correct ?

but what about the failover conditions that if the primary goes down then all the traffice must go on secondry link ???



you may also try to announce more specific networks on one ISP so that it will be the prefered path,  this requires no adjustment of LOCAL_PREF and AS_PATH. only need to put some appropriate filters.

Dear Jayprakash,