How Juniper Routing Policy Works

  • by

A advantage of route lists over prefix lists is that each prefix can include an action. When a match occurs, the action is taken immediately instead of waiting to reach the then clause. When the list of prefixes is long, this speeds up the processing of routing traffic. The following simple policy illustrates how this works:

Here I use the route filter policy with match condition “upto” and policy name we have declared “prefix-policy” and term name is “1”. Also I use here another term with a same policy, that will work with orlonger. The meaning of orlonger is; it uses upto /30 route, that mean here I use “192.168.100.0/24 orlonger”, that mean the route includes from /24 to /30 during the prefixes of 192.168.100.0/24. Finally created a reject policy, that mean only the allowed prefixes are 172.16.100.0/22 up /24 and 192.168.100.0/24 orlonger, rest of the all prefixes will be rejected.

[edit policy-options policy-statement prefix-policy]
# set term 1 from route-filter 172.16.100.0/22 upto /24
# set term 1 from route-filter 192.168.100.0/24 orlonger 
# set term 1 then accept
# set term 2 then reject

You can also use route lists as another way to manipulate the routing information in a route. Instead of screening routes by protocol or by other routing information they contain, you filter by destination prefix, I use here policy name as “set-metric-igp” and term name as “1”. Here I have added three prefixes with exact match condition and only those prefixes will be allowed to your routing table and rest of the all prefixes will be deleted. Also I am using here “local-preference 300”. The default value of BGP local preference is 100 and I have used here 300, because I need to receive this prefixes with high priority. Finally applied the reject policy; because I dont want to receive any other prefixes rather than those three.

[edit policy-statement policy-statement set-metric-igp]
# set term 1 from route-filter 10.12.0.0/16 exact
# set term 1 from route-filter 172.64.0.0/16 exact
# set term 1 from route-filter 192.168.0.0/24 exact
# set term 1 then local-preference 300
# set term 1 then accept
# set term 2 then reject

# show
policy-statement policy-statement set-metric-igp {
   term 1 {
        from {
             route-filter 10.12.0.0/16 exact;
             route-filter 172.64.0.0/16 exact;
             route-filter 192.168.0.0/24 exact;
        }
        then {
             preference 300;
             accept;
        }
   }
   term 2 {
        then reject;
   }

}

Leave a Reply