Before applying a routing policy in a live environment, you can use the test policy command to ensure that the policy produces the results that you expect. The test policy command uses the following syntax:
- user@host> test policy policy-name prefix
For more information about test commands, see the JUNOS Routing Protocols and Policies Command Reference.
Test the following policy, which looks for unwanted routes and rejects them:
- [edit policy-options]
- policy-statement reject-unwanted-routes {
-
- term drop-these-routes {
-
- from {
- route-filter 0/0 exact;
- route-filter 10/8 orlonger;
- route-filter 172.16/12 orlonger;
- route-filter 192.168/16 orlonger;
- route-filter 224/3 orlonger;
- }
- then reject;
- }
- }
Test this policy against all routes in the routing table:
- user@host> test policy reject-unwanted-routes
0/0
Test this policy against a specific set of routes:
- user@host> test policy reject-unwanted-routes 10.49.0.0/16