09-10-2020 08:18 PM
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?
09-10-2020 08:54 PM
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.
09-12-2020 11:30 AM
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
09-12-2020 07:29 PM - edited 09-13-2020 12:52 AM
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_
09-12-2020 11:25 PM
just the routes passed through.
09-13-2020 01:05 AM - edited 09-13-2020 01:06 AM
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
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide