01-12-2021 05:12 PM - edited 01-12-2021 05:16 PM
ip as-path access-list EMEA permit 652.._[1-5]... any
ip as-path access-list EMEA permit 652.._6[0-3]... any
ip as-path access-list EMEA permit 652.._64[0-4].. any
ip as-path access-list EMEA permit 652.._6450[0-9] any
ip as-path access-list EMEA permit 652.._6451[0-1] any
ip as-path access-list EMEA permit 65205_64553 any
ip as-path access-list EMEA-ORGINATED permit _652..$ any
can some one explain these as-path
01-12-2021 05:39 PM
This regex-based ACL to Permit - so you need to understand the regex-
https://networklessons.com/bgp/bgp-regular-expressions-examples
how that work here is a good document to start :
https://www.cisco.com/c/en/us/support/docs/ip/border-gateway-protocol-bgp/13754-26.html
01-13-2021 12:30 AM
Hello @HARISH KUMAR KANSAL ,
at first sight this as-path ACL is wrong there is no any keyword in regular expression .
There are some special characters that describe the AS path attribute as a sequence of strings.
^ this is the beginning of the AS path attribute
$ this is the end of the AS path attribute
these are called anchors
The _ is a concatenation operator and allows to describe a sequence of two AS numbers.
Then there are special characters that can be seen as "wildcard"
ip as-path access-list EMEA permit 652.._[1-5]..
This means match any AS path containing the sequence of AS numbers 652xy 3zk
The dot should match a single character whatever ( a digit in our case ) to be noted [1-5] means that the second AS number starts with a digit between 1 and 5 this is called a range.
To be noted the absence of anchors allows to match in any position not only at the beginning or near the end
Last line offers an example of matching on the last AS number
ip as-path access-list EMEA-ORGINATED permit _652..$
means match any AS path where the last AS number (thre rightmost) is starting with 652 followed by other two digits.
Note:
the usage of metacharacter dot '.' has to be verified but you should have got an idea
Hope to help
Giuseppe
01-13-2021 12:48 AM
Hello,
good question. The syntax looks a bit unfamiliar. What device is this configured on ? Could be a non-Cisco device ?
01-13-2021 10:01 AM
Hello
Just like to add you can test the output of regular expressions with the following commands, its a good way to test without deploying the filters.
Example:
sh ip bgp regexp _652..$ <- this will test the bgp expression
sh ip bgp quote-regexp “_652..$” | inc 65 <- this will test the bgp expression but also you could pipe to specific detail of the output
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