BGP/regexp - "match all routes not containing an AS"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2008 04:43 AM - edited 03-04-2019 12:03 AM
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
- Labels:
-
Routing Protocols
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2008 05:16 AM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2008 05:24 AM
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 .*
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2008 06:00 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2008 06:15 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2008 06:45 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2008 12:02 AM
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
