cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1972
Views
0
Helpful
5
Replies

Override BGP Local Pref for routes learned from specific AS

retiredyard
Level 1
Level 1

We have 3 internet service providers. ISP 1 and 2 both have local pref set to 200, with the 3rd left as the default. This is by design to avoid extra cost on the 3rd ISP due to bandwidth usage.

 

I need to override this local pref to prefer the 3rd ISP, only for routes learned from specific AS numbers (ex: the AS-path shows a route learned from 201 3468, I want to increase local pref so that traffic goes back this direction.)

 

I'm assuming this would be done through a policy based route, but I don't know how to match based on AS paths. Any ideas?

5 Replies 5

Francesco Molino
VIP Alumni
VIP Alumni

Hi

 

You can achieve that buy using as-path access-list.

I assume these 2 ASN can be anywhere on the as-path but they will be in the same order you gave.

The config would be:

ip as-path access-list 100 permit _201_3468_
!
route-map CMAP-ISP3 permit 10
match as-path 100
set local-pref 250
!
route-map CMAP-ISP3 permit 20
!
router bgp xxxx
neigh x.x.x.x route-map CMAP-ISP3 in

 

So by setting local pref at 250, we will make sure all prefixes with the 2 ASNs followed in the path will always prefer ISP 3. 

 

Hope that's clear.

 


Thanks
Francesco
PS: Please don't forget to rate and select as validated answer if this answered your question

Haven't had a chance to implement it. Would I just specify 2 as-path ACLs in the same route map if there were 2 AS path combos I wanted to use? Such as anything from 201 3468   or 303 3555.

ip as-path access-list 100 permit _201_3468_
ip as-path access-list 200 permit _303_3555_
!
route-map CMAP-ISP3 permit 10
  match as-path 100
  set local-pref 250
!
route-map CMAP-ISP3 permit 20
  match as-path 200
  set local-pref 250
!
route-map CMAP-ISP3 permit 30
!
router bgp xxxx
  neigh x.x.x.x route-map CMAP-ISP3 in

Hello

Do you would want prefer specific routes received that originated from ISP3 or passed through isp3 ?

if originated then the as-path filter would be either

_ISP3$

_ISP3_

 please note applying these filters will only be for egress traffic  your ingress traffic won’t be affected

Laslty you can test you filter even before applying if to see if it works accordingly 

show ip bgp regexp _ISP3$
show ip bgp regexp _ISP3_


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

just the routes passed through.

Hello

201 3468 = this state’s it originated from AS3468 but transit through AS201 so i assume then your ISP3 is ASN201 ?

@Francesco Molino provided a filter to match on a asn path based on the above but it all depends on what exactly you would to filter however suggest you test any regular expression BEFORE applying it to see if the results are what you expect

review the below url:

https://www.cisco.com/c/en/us/td/docs/ios/12_2/dial/configuration/guide/dafaapre.html

 


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