07-30-2024 07:07 PM
Dear experts
There's an example in <300-410 Official Cert Guide>:
This is original BGP table:
After issue show bgp ipv4 unicast regexp (10)+[^(100)] command, the result in book is:
But when I did it on my machine, only two prefixes are visible: 172.16.192.0/24 and 192.168.129.0/24. Does anyone please explain this regexp in detail? Or is there any article or document or book expound it deeply?
Thanks a lot
- Teck Sing
Solved! Go to Solution.
07-31-2024 01:17 PM - edited 07-31-2024 01:23 PM
Hi @Teck Sing ,
I suppose there has been a changed in the regexp engine behavior since the book guide has been released. The behavior you are seeing makes sense.
172.16.4.0/23 and 192.168.4.0/23 are rejected because the (10)+ matches all the occurences of 10 in the AS path, which leads you to the end of the AS path. The regexp then searches for a value that different than 100 (^100). This value is not found as the end of the AS path is reached.
Regards,
07-30-2024 07:14 PM
07-30-2024 07:36 PM
Did you configure it exactly like the example in the book? You have network 172.16.192.0/24 but thats not even a network in the example you provided.
Secondly, Are all your routes going through all the AS#s provided by the book example. Can you provide your configuration and topology? It needs to mimic the book exactly to get the same results most likely.
-David
07-30-2024 11:43 PM
Hi, David
172.16.192.0/24 is a typo, it's 172.16.129.0/24. I've topology like this:
and use loopback interfaces to simulate prefixes on R1 and R3 (they are in AS100 and AS300 respectively), the AS-Path list is prepended via route-map. So on R2, I got BGP table exactly same as the book's.
I run all examples in book, there's no problem except for this one. So I wonder what's the meaning of (10)+[^(100)] in this regexp query, especially [^(100)]? Because I change the number in the parentheses, could lead to different results.
Thanks!
- Teck Sing
07-31-2024 10:31 AM
paren is grouping and + means 1 or more so (10)+ equals one or more 10. A caret ^ inside a square bracket [^ means NOT so [^(100)] means NOT 100. put that together (10)+[^(100)] and you have one or more 10 followed by NOT 100. Your example looks like your caret is very large and your keyboard could be set for unicode and sending Arabic-Indic Digit Eight ٨ and not ascii caret ^.
08-06-2024 10:27 PM
Hi, Dan
Thanks. But in another example, the caret ^ works as expected like below:
BTW, how to set keyboard?
- Teck Sing
07-31-2024 12:37 PM
please share roue-map for prepend let me check in lab
MHM
08-06-2024 10:32 PM
Hi, MHM
Here's route-map and ACL on one router for your reference. Appreciate you'll check in your lab.
- Teck Sing
07-31-2024 01:08 PM
Hello @Teck Sing
The regex (10)+ matches one or more occurrences of the string "10", so it will match paths like "10", "1010", "101010", etc.
The [^(100)] part is a character class that matches any single character that is not `(`, `1`, `0`, or `)`. Therefore, the command filters AS_PATHs that contain one or more instances of "10" consecutively, followed by any character that is not one of `(`, `1`, `0`, or `)`. For example, AS_PATHs like `10 20 30` or `1010 2020 3030` would match because they meet these criteria.
Check book like "BGP Design and Implementation" by Randy Zhang.
08-06-2024 10:59 PM
Hello, M02@rt37
If router treats '(' and ')' as common character in square brackets, escape character is not needed?
Thanks
- Teck Sing
07-31-2024 01:17 PM - edited 07-31-2024 01:23 PM
Hi @Teck Sing ,
I suppose there has been a changed in the regexp engine behavior since the book guide has been released. The behavior you are seeing makes sense.
172.16.4.0/23 and 192.168.4.0/23 are rejected because the (10)+ matches all the occurences of 10 in the AS path, which leads you to the end of the AS path. The regexp then searches for a value that different than 100 (^100). This value is not found as the end of the AS path is reached.
Regards,
08-06-2024 11:09 PM
Hello, Harold
It seems you are right. When I add another AS number at the end of 192.168.4.0/23 AS_Path list, this prefix appears.
Thanks a lot!
- Teck Sing
08-06-2024 11:40 PM
You are very welcome @Teck Sing and thanks for the feedback
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