published: 23rd of February 2019
Junos routing policy allows an administrator to alter the default behaviour of a routing protocol. All routing protocols try to determine the best path to a destination based on the protocols definition of the best "metric". The Junos routing policy framework allows an administrator to influence the best path based on their business needs.
There are two places routing policy can be applied.
The use of a routing policy alters a routers view of the network topology. If you apply a policy inbound it will alter the local routers perception of the network topology. Applying a policy outbound will alter a neighbours perception of the network topology.
BGP policies can be applied at three levels. The below list is order from the most to least preferred.
Less preferred policies are ignored if a more preferred match is also configured.
Terminating actions define how a route match is utilised. The options are accept and reject . Their usage is as follows.
Prior to a route being accepted or rejected by a terminating action the routes attributes can be modified. Below are some common usage examples of action modifiers.
There are two flow control statements that can be used within routing policy.
There are two methods to define a routing policy. term based and non-term based .
Non-term based policies can only have one set of match/action statements.
policy-options {
policy-statement POLICY-NAME {
from {
MATCH-CONDITIONS;
}
then {
ACTIONS;
}
}
}
Term based policies allow for more than one set of match/action statements using a term block.
policy-options {
policy-statement POLICY-NAME {
term TERM-NAME {
from {
MATCH-CONDITIONS;
}
then {
ACTIONS;
}
}
term TERM-NAME {
from {
MATCH-CONDITIONS;
}
then {
ACTIONS;
}
}
}
}
Route filters are used to apply routing policy to a specific route (or set of routes). There are a number of methods to match a route(s) which are outlined below.
A radix tree is used to match prefixes based on the route filter conditions. The below diagram[1] is a sample radix tree.
The below diagram[2] illustrates how route filters affect the selection of prefixes in the radix tree.
The default manner in which Junos handles routing policy is outlined in the table below.
Protocol | Import | Export |
---|---|---|
BGP | Accept all received IPv4/6 routes and place them in the inet.0/6 table. | Re-advertise all IPv4/6 routes to all BGP neighbors apart from iBGP peers unless local router is a route reflector. |
OSPF/v3 | Accept all OSPF received IPv4/6 routes and place them in the inet.0/6 table. | Reject everything. OSPF uses flooding to advertise local and learned routes. |
IS-IS | Accept all IS-IS received IPv4/6 routes and place them in the inet.0/6 table. | Reject everything. IS-IS uses flooding to advertise local and learned routes. |
RIP/ng | Accept all RIP/ng received IPv4/6 routes and place them in the inet.0/6 table. | Reject everything. An export policy is required to export RIP/ng routes. |