
route-policy quickstart-remarks
# Handle routes to RFC1918 networks
if destination in rfc1918 then
# Set the community such that we do not export the route
set community (no-export) additive
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
Routing Configuration Guide for Cisco NCS 6000 Series Routers, IOS XR Release 6.4.x
394
Implementing Routing Policy
Routing Policy Configuration Basics