04-04-2016 12:32 PM - edited 03-05-2019 03:43 AM
Hi, Could some one please help me with understanding what would the below AS-PATH access-list accomplish?
Router01#sh run | in as-path
ip as-path access-list 100 permit ^64512(_64512)*$
ip as-path access-list 100 permit ^64512(_64512)*(_64513)*$
This is then configured under BGP with the following command - 'neighbor x.x.x.x filter-list 100 in'
I understand that ^ means that the router will only accept prefixes that have originated from AS 64512. However, I'm unable to understand how the parentheses and the other expressions (*,_,$) applies in this configuration.
Any help would be appreciated. Thanks!
(I have changed the AS numbers to private AS numbers for security reasons)
Regards,
Paul
04-05-2016 12:37 AM
Hi Paul,
you can find some general information about Regular Expressions in IOS HERE.
Another useful link is the AS Regular Expressions section of the BGP Case Studies.
_64512 means one delimiter (Space/Blank, Tab, etc.) followed by 64512, e.g. " 64512".
(_64512) is the same thing, the parentheses group the expression _64512 so you can combine it with a quantifier.
* is a quantifier. It means 0 or more occurrences of the group. So (_64512)* matches an empty string (0), " 64512" (1), " 64512 64512" (2), " 64512 64512 64512" (3) and so on.
^ and $ match the beginning and the end of a string.
So the first line says the as-path has to begin with 64512, optionally followed by any number of repetitions of that AS, e.g. "64512 64512 64512" (Origin: 64512). The second line additionally allows optionally any number of occurrences of AS 64513 at the end of as-path, e.g. "64512 64512 64513 64513" (Origin: 64512 OR 64513). The first line seems to be somewhat redundant.
In a nutshell:
• minimum accepted AS_PATH: "65512"
• accepted AS_PATH expressions 1 and 2: "65512 65512 65512 (...) 65512"
• accepted AS_PATH expression 2: "65512 65513"
• accepted AS_PATH expression 2: "65512 65513 65513 (...) 65513"
• accepted AS_PATH expression 2: "65512 65512 65512 (...) 65512 65513 65513 (...) 65513"
It's not easy to explain ...
HTH
Rolf
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