You are on page 1of 15

Building Blocks of Routing Policies

Policy Components
• Terms:
• named structures in which match conditions and actions are defined
• one or more terms can be defined

• Match Conditions:
• criteria against which a route or packet is compared
• one or more criteria can be configured
• if all criteria match, one or more actions are applied
Policy Components
• Actions:
• what happens if all criteria match
• one or more actions can be configured
Policy Components
• Terms are basic building blocks of all Junos policies

• Essentially, they are if...then statements

• If all the match conditions specified in the from statement are true,
all the actions in the then statement are executed
Policy

Term 1

from then
match

Term 2

from then
match
Routing Policy Evaluation
• The route is evaluated against the first term. If it matches, the
specified action is taken

• If the action is to accept or reject the route, that action is taken and
evaluation of the route ends
Routing Policy Evaluation
• Evaluation continues to the next term if the route does not match,
or if no action is specified, or if the next term action is specified

• If the route matches no terms in the routing policy, the accept or


reject action specified by the default policy is taken
Route

Policy

Term 1

Accept or Reject

Term 2

Accept or Reject

Default
Action
policy-statement my-policy {
term accept-direct-routes {
from {
protocol direct;
interface ge-0/0/0;
}
then accept;
}
term reject-rip-routes {
from protocol rip;
then reject;
}
}
Routing Policy Match Conditions
• Each term in a routing policy can include two statements, from and
to, to define the conditions that a route must match for the policy
to apply

• In the from statement, you define the criteria that an incoming


route must match

• If more than one criteria is matched, they must all match the route
for a match to occur
Routing Policy Match Conditions
• The from statement is optional

• If omitted, all routes are considered to be a match

• All routes then take the configured actions of the policy term
Routing Policy Match Conditions
• In the to statement, you define the criteria that an outgoing route
must match

• If more than one criteria is matched, they must all match the route
for a match to occur

• The to statement is optional


Routing Policy Actions
• Each term in a routing policy can include a then statement, which
defines the actions to take if a route matches all the conditions

• The then statement may include one or more actions


Routing Policy Actions
• Three types of actions:
• flow control actions – these decide whether to accept or reject the route
and whether to evaluate the next term or routing policy
• actions that manipulate route characteristics

• trace action – this logs route matches


Routing Policy Actions
• The then statement is optional, if omitted one of the following
occurs:
• the next term in the routing policy, if one present, is evaluated
• if there are no more terms in the routing policy, the next routing policy, if
one present is evaluated
• if there are no more terms or routing policies, the accept or reject action
specified by the default policy is taken

You might also like