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

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

For an introduction to the new site, click here. And see here for current known issues.

New Member

BGP/regexp - "match all routes not containing an AS"

I need someone smart to please help me out on this one.

Using a regular expression, we're trying to match all routes NOT containing a particular AS. I've seen how to match all sorts of things but I've never seen how to NOT match something.

Help?

Thanks in advance,

Tom

6 REPLIES
New Member

Re: BGP/regexp - "match all routes not containing an AS"

What about a regexp matching the AS in question, and using a deny statement? Or am I missing the point? Which AS do you want to exlude?

Re: BGP/regexp - "match all routes not containing an AS"

Tom,

not sure if this is what you are looking for

This example Deny routes Originated in AS 4 to Enter and Permit all other routes

ip as-path access-list 1 deny _4$

ip as-path access-list 1 permit .*

New Member

Re: BGP/regexp - "match all routes not containing an AS"

Thanks for the reply but there are two problems.

1. I'm looking for a single regular expression not an as-path access-list.

2. I'm trying to block either all as-paths including a particular AS, or all as-paths with a particular AS as the last AS in the path. for example blocking these as-paths because they include '100: '100 200 300', '100 500 600 600 700', but allowing '500 600 700'

Thanks!

Tom

New Member

Re: BGP/regexp - "match all routes not containing an AS"

You can use:

_100$ -> any AS-path with AS 100 as origin AS

_100_ -> any AS-path with AS 100 in the AS-path (AS 100 was transited).

These two regexp will match I think your requirement when you apply them in an as-path access-list (as deny), and permit all others. You say you do not want to use an as-path access-list, but how are you going to apply the regexp to your BGP updates?

HTH, Thomas

New Member

Re: BGP/regexp - "match all routes not containing an AS"

Ok. Since I'm not actually the one who configures the routers, I'm going let our engineer know and see what he comes back with.

Thanks for the help and advice. I'll report back with what I find.

Thanks,

Tom

Re: BGP/regexp - "match all routes not containing an AS"

Hi,

do you require a single regexp to modify the "sh ip bgp regexp" output?

If yes, it's not easy I'm afraid.

IMHO, you could use "sh ip bgp route-map" command instead and create a proper route-map to filter the AS out.

Or "sh ip bgp | exclude ( the_as_number )"

which should give you the required output, but might no work reliably for some AS numbers like 10, 150, etc. (clashing with other values listed in the same line).

HTH,

Milan

937
Views
0
Helpful
6
Replies