You want to reject routes from any BGP peers that have prepended their AS path. What is the correct as-path regex that would allow you to accomplish this task?
A. 65001.*
B. .{2,}
C. (65001|65001|65001)
D. .{0,1}
You want to reject routes from any BGP peers that have prepended their AS path. What is the correct as-path regex that would allow you to accomplish this task?
A. 65001.*
B. .{2,}
C. (65001|65001|65001)
D. .{0,1}
Should be B:
. (dot) Wildcard. Matches any single character at the current position in the data set.
{m,} m or more repetitions of term. m must be a positive integer.
Source: https://www.juniper.net/documentation/en_US/junos/topics/usage-guidelines/policy-configuring-as-path-regular-expressions-to-use-as-routing-policy-match-conditions.html
B is not the answer! the same AS can appear twice in the flow – and yes it’s a “loop” that you can allow… but it’s not a prepend!
B
.{2,} : Any AS path with AS number appear at lease twice
Path of any length, except nonexistent, whose second AS number can be anything, including nonexistent
. .* or . .{0,}
So… B?
B & D are both valid, i tested it and both are working.
Difference is the polcy i put term1 from as-path “.{2,}” then reject and term 2 then accept it works
and for term1 from as-path “.{0,1}” then accept and term 2 then reject it works too, so i think best is D because by “best practice” we put reject statement at the end not at the beginning.
D is right
https://www.juniper.net/documentation/en_US/junos/topics/usage-guidelines/policy-configuring-as-path-regular-expressions-to-use-as-routing-policy-match-conditions.html
I think it should be B. When you send route to EBGP neighbor, your AS is by default put in AS path. If you are using AS prepending, then you will have 2 or more repetitions of your AS number in AS path and that is exactly what .{2,} matches
Agree with Dejan. B.