cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3241
Views
0
Helpful
6
Replies

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

tom.gill
Level 1
Level 1

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 6

tcordier
Level 1
Level 1

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?

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 .*

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

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

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

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

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Review Cisco Networking products for a $25 gift card