One can find routes matching an IP using show route 192.0.2.123
. What is the equivalent way to find matching prefixes, if any, in a long prefix list? … to determine quickly and conclusively whether or not an IP matches a prefix list? … to generate a list of all prefix lists that an IP matches?
How to test an IP against a prefix list on JUNOS CLI
clijuniper-junosprefix
Best Answer
In Junos you have the command:
however, it doesn't do quite what you are asking.
Firstly, create your prefix-list and match it in a policy:
Now, given the following routes in inet.0:
run the test:
And you'll see you only get one match.
The prefix you enter into the test command basically says "show me all the routes that match this prefix or longer" - in a similar to the way a
show route
command works.However, when matching a prefix list, prefixes are matched exactly, so even though our prefix list has a covering prefix (eg:
172.16.10.32/27
) that doesn't cause a match because that exact prefix isn't in the routing table.