[j-nsp] Searching by prefix length

Stacy W. Smith stacy at acm.org
Thu May 5 18:25:34 EDT 2011

One way you could do this would be to write and commit a policy that matches the conditions you want and accepts them, then discards everything else. Then, use the 'test policy' command to display the output.

user at router> test policy foo 0/0 

inet.0: 2 destinations, 2 routes (2 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both     *[Direct/0] 1w1d 01:48:38
                    > via ge-2/0/0.0

Policy foo: 1 prefix accepted, 1 prefix rejected

Note that the first argument to 'test policy' is the name of the policy to test. The second argument is the range of active prefixes in your local routing table which should be used as input to the routing policy. By using 0/0, your evaluating the policy against all active IPv4 routes in your routing table. Only routes that are accept by the policy will be displayed in the output.

Note, use 'test policy foo ::/0' to evaluate the policy against active IPv6 prefixes in inet6.0.


On May 5, 2011, at 3:51 PM, Bill Blackford wrote:

> I want to be able to search the route table for prefixes announced
> from a certain peer and of a range of lengths. ex, give me all routes
> announced from and through HE but filter by 'upto' /19.
> so,
> show route aspath-regex .*6939.* terse  <upto /19>
> or,
> show route receive-protocol bgp ###.###.###.### aspath-regex .*6939.*
> terse <upto /19>
> Is there way to do this?
> The best I've come up with is 'sh route aspath-regex .*6939.* | except
> /2' This is obviously not a very flexible approach.
> Thank you,
> -b
> -- 
> Bill Blackford
> Network Engineer
> Logged into reality and abusing my sudo privileges.....
> _______________________________________________
> juniper-nsp mailing list juniper-nsp at puck.nether.net
> https://puck.nether.net/mailman/listinfo/juniper-nsp

More information about the juniper-nsp mailing list