07-26-2005 02:39 AM - edited 03-03-2019 10:07 AM
Is there a regexp for BGP private ASs.
I would like to put them in an expanded community-list?
Many kind regards,
Ken
Solved! Go to Solution.
07-26-2005 05:43 AM
Ken,
You need to specify the ^ and $ only at the beginning and at the end. The following community-lists should do what you want.
R1#sh ip community-list
Named Community expanded list group1
permit ^64[6-8][0-9][0-9]:123$
Named Community expanded list group2
permit ^649[0-9][0-9]:123|65[0-1][0-9][0-9]:123$
Named Community expanded list group3
permit ^65[2-5][0-9][0-9]:123$
Hope this helps,
07-26-2005 03:24 AM
I'm not sure I understand your question. regexp works for all ASNs. Could you please clarify your question.
Thanks,
07-26-2005 03:34 AM
Sorry about that,
I want to match a specific community value (a global LP community setting) so when I receive this community value privateas:xxxx i will set the attribute.
So, if we had a private AS range in the following regions set
Region AS Range
Region1 64600 64899
Region2 64900 65199
region3 65200 65535
if I receive a community value of any of the above ASs with a :123 i will set LP to 95.
ip community-list expanded companyASs permit ^64[6-9][0-9][0-9]$:123
ip community-list expanded companyASs permit ^65[0-4][0-9][0-9]$:123
ip community-list expanded companyASs permit ^655[0-2][0-9]$:123
ip community-list expanded companyASs permit ^6553[0-5]$:123
Is there a way to use regular expressions to match all of these ASs in one line and thus cut the config down?. I am not a big regexp master?
Kind regards,
Ken
07-26-2005 04:35 AM
I have just seen the OR funtion
no ip community-list expanded companyASs
ip community-list expanded companyASs permit _64[6-9][0-9][0-9]:123_|_65[0-4][0-9][0-9]:123_|_655[0-2][0-9]:123_|_6553[0-5]:123_
but funny how the ^ and $ donot work with the or function
no ip community-list expanded companyASs
ip community-list expanded companyASs permit ^64[6-9][0-9][0-9]:123$|^65[0-4][0-9][0-9]:123$|^655[0-2][0-9]:123$|^6553[0-5]:123$
I like using the carrat dollar, but dont thin I can, unless anyone knows to the contary?
Best regards as always,
Ken
07-26-2005 05:43 AM
Ken,
You need to specify the ^ and $ only at the beginning and at the end. The following community-lists should do what you want.
R1#sh ip community-list
Named Community expanded list group1
permit ^64[6-8][0-9][0-9]:123$
Named Community expanded list group2
permit ^649[0-9][0-9]:123|65[0-1][0-9][0-9]:123$
Named Community expanded list group3
permit ^65[2-5][0-9][0-9]:123$
Hope this helps,
07-26-2005 06:05 AM
thx, thats gr8 fella.
many thx as usual :)
07-27-2005 03:14 PM
Hi hritter,
Shouldn't the last one be
^65[2-5][0-3][0-5]:123$
The below range is what Ken was looking at, right ?
region3 65200 65535
Regards
Arav.
07-27-2005 04:52 PM
Your regexp only allows 65200 to 65235, 65300 to 65335, 65400 to 65435 and 65500 to 65535.
The regular expression I suggested (65[2-5][0-9][0-9]) allows 65200 to 65599 but no community can be larger than 65535 anyway.
Hope this helps,
07-27-2005 11:55 PM
Quick one just to end up with on this is.
can we just have a community-list that either says :-
ip community-list standard/expanded permit range 64512 65535
or
ip community-list standard/expanded permit private-as-range
:)
man, could i raise a feature request for it?
if it was that easy though, we would all be out on our ears :))
many thx to all for their input :)
the pub opens in 2h4m - cant wait!!
07-28-2005 04:26 AM
I guess it would be nice to call the private AS range by name just like we do for the internet, local-AS, no-advertise and no-export communities.
Please have a pint for me ;o)
07-28-2005 07:03 PM
Hello,
This subject has probably been beaten to death but I looked into the same issue about a year ago and this is the one line regular expression that somebody suggested that seemed to work just fine:
_6451[2-9]_|_645[2-9][0-9]_|_64[6-9][0-9][0-9]_|_65[0-4][0-9][0-9]_|_655[0-2][0-9]_|_6553[0-5]_
I know it is bordering on ridiculous but it works :-)
06-21-2012 12:46 PM
BGP Regular Expression for 64512-65535 (Private ASs)
this is for 16bit private ASs
ip as-path access-list 66 permit
_(6451[2-9]|645[2-9][0-9]|64[6-9][0-9][0-9]|65[0-4][0-9][0-9]|655[0-2][0-9]|6553[0-5])_
so
so this regex 64[5-9][0-9][0-9]|65[0-5][0-9][0-9] won't work with 32bit private AS's)
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide