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

Unanswered Question
  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 0 (0 ratings)
tcordier Thu, 10/23/2008 - 05:16
User Badges:
  • Bronze, 100 points or more

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?

francisco_1 Thu, 10/23/2008 - 05:24
User Badges:
  • Gold, 750 points or more


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'



tcordier Thu, 10/23/2008 - 06:15
User Badges:
  • Bronze, 100 points or more

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

milan.kulik Fri, 10/24/2008 - 00:02
User Badges:
  • Red, 2250 points or more


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




This Discussion