10-03-2005 11:08 PM - edited 03-03-2019 10:39 AM
In regexp, how is the underscore used? From Cisco docs it says, _ can be used to replace a comma (,), left brace {, right brace }, ^, $ and space. This is in regards to using regexp in BGP as-path filtering. The objective is to prevent a client peered to one of the isp edge routers from advertising transit routes to the isp edge router. Lets say the clients AS is 779. The task is to permit only prefixes originated from AS 779. Prefixes with the following as-path is allowed:
1.) 779
2.) 779 779
Prefixes with the following as-path is not allowed:
3.) 779 1224
Having some prefix pre-pended with their own AS will rule out the option of using ^779$. The usage of _779_ however would exclude prefixes with other AS in the as-path string. My understanding of underscore is to include any string; meaning _779_ includes any string that is before and after 779. So correct me if Im wrong.
Thank you all so much. Confused!
Solved! Go to Solution.
10-04-2005 03:00 AM
You are correct in saying that _779_ would allow any aspath that includes 779 regardless what is before or after.
In you scenario, you want something like _779$.
Let me know if I answered your question,
10-04-2005 03:00 AM
You are correct in saying that _779_ would allow any aspath that includes 779 regardless what is before or after.
In you scenario, you want something like _779$.
Let me know if I answered your question,
10-04-2005 05:12 AM
Hi,
Thanks. Yah, that was just what I needed. But I'm still confused as to how using _779_ actually did filter out prefixes with AS path 779 1224 when I tried it out.
But _779$ really makes sense, anything that ends with 779, including what is before 779. This definitely does exclude other prefixes that were originated from other AS passing through 779.
10-04-2005 12:14 PM
I'm not sure why _779_ filtered out aspath 779 1224 but it shouldn't have as it matches.
Hope this helps,
10-06-2005 10:14 AM
Try this one:
^779(_(779))*$
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: