Cisco Systems OL-14356-01 Network Router User Manual


 
Implementing Routing Policy on Cisco IOS XR Software
Information About Implementing Routing Policy on Cisco IOS XR Software
RC-363
Cisco IOS XR Routing Configuration Guide
OL-14356-01
endif
end-policy
Routing Policy Configuration Basics
Route policies comprise series of statements and expressions that are bracketed with the route-policy
and end-policy keywords. Rather than a collection of individual commands (one for each line), the
statements within a route policy have context relative to each other. Thus, instead of each line being an
individual command, each policy or set is an independent configuration object that can be used, entered,
and manipulated as a unit.
Each line of a policy configuration is a logical subunit. At least one new line must follow the then, else,
and end-policy keywords. A new line must also follow the closing parenthesis of a parameter list and
the name string in a reference to an AS path set, community set, extended community set, or prefix set.
At least one new line must precede the definition of a route policy, AS path set, community set, extended
community set, or prefix set. One or more new lines can follow an action statement. One or more new
lines can follow a comma separator in a named AS path set, community set, extended community set, or
prefix set. A new line must appear at the end of a logical unit of policy expression and may not appear
anywhere else.
Policy Definitions
Policy definitions create named sequences of policy statements. A policy definition consists of the CLI
route-policy keyword followed by a name, a sequence of policy statements, and the end-policy
keyword. For example, the following policy drops any route it encounters:
route-policy drop-everything
drop
end-policy
The name serves as a handle for binding the policy to protocols. To remove a policy definition, issue the
no route-policy name command.
Policies may also refer to other policies such that common blocks of policy can be reused. This reference
to other policies is accomplished by using the apply statement, as shown in the following example:
route-policy check-as-1234
if as-path passes-through ‘1234.5’ then
apply drop-everything
else
pass
endif
end-policy
The apply statement indicates that the policy drop-everything should be executed if the route under
consideration passed through autonomous system 1234.5 before it is received. If a route that has
autonomous system 1234.5 in its AS path is received, the route is dropped; otherwise, the route is
accepted without modification. This policy is an example of a hierarchical policy. Thus, the semantics
of the apply statement are just as if the applied policy were cut and pasted into the applying policy:
route-policy check-as-1234-prime
if as-path passes-through '1234.5' then
drop
else
pass
endif
end-policy