Showing results for 
Search instead for 
Did you mean: 

BGP Conditional Route Filtering

Hi All,


I have router with 2 Connection.

1) IP Transit from Tier 2 Provider

2) IX - Local Internet Exchange for local peering

I'm receiving full internet route nearly 500k+ entries. I also have few local peering through IX connection to local telco. Now that , Im receiving more specific route from IP Transit link compared to local peering . Eg

Local Peer A( ASN YYYY)  send route : a.a.0.0/16

IP Transit send route : a.a.1.0/24

With this , My traffic to a.a.1.0/24 end up routed over IP transit link. But we need the traffic routed via IX Peering, since its direct peering and have low latency and high bandwidth capacity. 

Im thinking, to filter AS-PATH YYYY from IP Transit link, so that anyy traffic to ASN YYYY will now routed over local IX Peering. But, this will cause traffic get dropped if My Port to IX or Peering Partner Port to IX is went down.  The traffic then should routed over IP transit link if local peering is down. Meaning to say , AS-Path filtering should be removed if local peering to that ASN is down.

Any Idea how to accomplish this ?


Regards, Nagis
VIP Mentor

HelloYou dont say if this is


You dont say if this is just one router with two perrings or two routers with ibgp between them each with a isp peering?

However i for outbound traffic you can use  either Weight or local Prefeance path selection for your local traffic to be go over your selected link.

For inbound As-Path prepending would be apllcable I think



Weight (Is locally significant - Just one router)

access-list 10 permit x.x.x.x y.y.y.y

route-map Weight permit 10
match ip address 1
set weight 400000

route-map Weight permit 99


router bgp xx
neigbour x.x.x.x route-map Weight out (to ebgp perring for your prefered choice path)


route-map Local-Pref permit 10 ( for IBGP routers)
match ip address 1
set local-preferance 200

route-map Local-Pref permit 99


router bgp xx
neigbour x.x.x.x route-map Local-Pref in (to ebgp perring for your prefered choice path)



AS=PAth prepend

route-map AS-Path permit 10
match ip address 10
set as-path prepend ASN ASN ASN

route-map AS-Path permit 99

router bgp xx
neigbour x.x.x.x route-map AS-Path out ( to the least preffered ISP)




kind regards

Please rate and mark posts accordingly if you have found any of the information provided useful.
It will hopefully assist others with similar issues in the future

Hi, Its single router. Your



Its single router. Your solution is workable only if two route with same subnet mask received from two BGP neighbour. But, is this case its not, because IP Transit link receiving more specific route than my IX peering. But I need the traffic to be sent over IX Peering since its direct peering  The first rule in route selection is longest matching bits regardless of which routing protocol used. 

Regards, Nagis

Hi Nagiswaren,You can use

Hi Nagiswaren,

You can use advertise-map with Non-exist MAP in BGP.

if a.a.0.0/16 route do not exist then advertise a.a.1.0/24 subnet so BGP will not add subnet a.a.1.0/24 in table until route a.a.0.0/16 is missing from table.


Please rate the post if it solves your problem.





Hi Mohinder, Im not sure how

Hi Mohinder,


Im not sure how this will work, because im not originator of this route and im not advertising to anybody. This route i'm receiving from two different Peering Neighbour

Regards, Nagis

HI Nagis, it work in 2 ways.

HI Nagis,


it work in 2 ways. it will remove route from table so even not advertising to neighbor but it will remove from local routing table also.





Hi Mahi, Thanks . Thats could

Hi Mahi,


Thanks . Thats could solve my solve problem in small scale.. But im having the same problem for more than 1000 prefix.. I did some trick, but not sure if it best solution.

I have applied as-path filtering in IP Transit BGP peering, so that I wont receive any prefix same as local peering from this neighbour. To overcome traffic get dropped if local peering down, i have added static default route via IP Transit link, 

Regards, Nagis

Hi Nagis,Thanks for the

Hi Nagis,

Thanks for the update. I think that will work as well fine.



CreatePlease to create content
Content for Community-Ad
FusionCharts will render here