Cisco Support Community
Showing results for 
Search instead for 
Did you mean: 

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. If you'd prefer to explore, try our test area to get started. And see here for current known issues.

New Member

Question about BGP AS path Filtering.

I had a question about How I could best setup a filter to correct a problem of an ISP.

I have a connection to Qwest's network useing AS 3908. they have 3 AS's becuase of a law that says they can't have Networks Cross Lata's so Most other provider Peer with Qwest to AS 209 and Qwest also own's AS 19092. I comenly get routes like this. this is part of the ooutput of a sh ip bgp

Network Next Hop Metric LocPrf Weight Path

* x.x.x.x 0 3908 19092 209 14746 i

*> x.x.x.x 0 701 4200 14746 i

* i x.x.x.x 0 7018 209 14746 i

And like this.

* i12.0.48.0/20 x.x.x.x 0 7018 209 1742 i

*> x.x.x.x 0 701 209 1742 i

* x.x.x.x 0 3908 19092 209 1742 i

So As you can see The first route has the list of qwest AS's and then the AS that own's the network You can see that it selects the second route as the best path.

And if you look at the second network you can see that it also doesn not select the Qwest route whil the two other peer actually go through qwest to get to that AS.

I've figured that i could write a filter for the non qwest links to set a local preference to a low number if it's as path contans AS 209 so that the Qwest route woudl be preferable but it doesn't seem to address the First problem. I was wondering if someone could tell me a better solution. or if there was a way to serach and replace as such with AsPaths so I could replace the 3 AS string with just one AS.

Thank you for your time.


Re: Question about BGP AS path Filtering.

You can't shorten the AS PATH, but maybe you could prepend the path if you're just receiving these routes and not re-advertising to another peer,etc. This would make the AS PATH longer then Qwest routes that you want to take.


access-list 101 permit ip (route/wildcard you want to prepend) any

router bgp ##

neighbor x.x.x.x route-map ppend in

route-map ppend permit 10

match ip address 101

(and/or match an as-path...)

set as-path prepend 701 701 701 701


New Member

Re: Question about BGP AS path Filtering.

I am trying to stay away from setting metrics on just random routes. I was trying to make it select the best path for the traffic. but make it a little more even. A filter that I kindof thought about might be something like match those 3 AS's and one more as at then end of those and make that route more preferable. This works in a lot of the cases. I just thought I would ask the question thought to see if someone had a better Idea. Thank you for your response.

Re: Question about BGP AS path Filtering.

Another idea, would to act on communities or tags if your providers are using those options.


Re: Question about BGP AS path Filtering.

Do you want the first route to be chosen in both cases? It seems to me that you could set up a filter to raise the local pref if all three of the provider's as' are in the path, but lower it if only one is (?). I think we need to understand what it is you want to do better.


New Member

Re: Question about BGP AS path Filtering.

Their are a lot of the routes from that provider with the 3 as's in it's as path. it isn't alwasy the best path to take this provider. I was wondering if there is a good way to fix this. If I could do something like search for the 3 as's and replace them with one as that would fix my entire problem, but I can't do that I was wondering if there was just something that I didn't know about that I could use to fix the problem. This is kinda what I put in place to fix some of the problem

On my other providers links I have a route-map in bound to set the local-pref lower when it matches _209_ or _19092_ and then on the one troublesome provider I put a route-map inbound and set the local-pref Higher when it matches

^3908 19092 209$

^3908 19092$

^3908 19092 209 [0-9]+$

^3908 19092 [0-9]+$

I was just wondering if there was anything anyone else could think of that I could do to fix more fo the routes.

I also had another question, from looking in one of the Cisco press BGP books, it explains how to do regular expressions and tells you what the ? | and so on do, but you are unable to use them in the as-path access-lists. I guess I just thought I would point that out.