Cisco IOS XR Routing Command Reference, Release 3.3
Routing Policy Language Commands on Cisco IOS XR Software

Table Of Contents

Routing Policy Language Commands on Cisco IOS XR Software

abort

add

apply

as-path in

as-path is-local

as-path length

as-path neighbor-is

as-path originates-from

as-path passes-through

as-path-set

as-path unique-length

community is-empty

community matches-any

community matches-every

community-set

delete community

delete extcommunity rt

destination in

drop

edit

end-policy

end-set

extcommunity rt is-empty

extcommunity rt matches-any

extcommunity rt matches-every

extcommunity-set cost

extcommunity-set rt

extcommunity-set soo

extcommunity soo is-empty

extcommunity soo matches-any

extcommunity soo matches-every

if

med

next-hop in

orf prefix in

origin is

pass

prefix-set

prepend as-path

protocol

rd in

rd-set

rib-has-route

route-has-label

route-policy (RPL)

route-type is

rpl editor

rpl maximum

set community

set cost

set dampening

set eigrp-metric

set extcommunity cost

set extcommunity rt

set isis-metric

set label

set level

set local-preference

set med

set metric-type (IS-IS)

set metric-type (OSPF)

set next-hop

set origin

set ospf-metric

set rib-metric

set rip-metric

set rip-tag

set tag

set traffic-index

set weight

show rpl active as-path-set

show rpl active community-set

show rpl active extcommunity-set

show rpl active route-policy

show rpl active prefix-set

show rpl as-path-set

show rpl as-path-set attachpoints

show rpl as-path-set references

show rpl community-set

show rpl community-set attachpoints

show rpl community-set references

show rpl extcommunity-set

show rpl inactive as-path-set

show rpl inactive community-set

show rpl inactive extcommunity-set

show rpl inactive prefix-set

show rpl inactive route-policy

show rpl maximum

show rpl prefix-set

show rpl prefix-set attachpoints

show rpl prefix-set references

show rpl route-policy

show rpl route-policy attachpoints

show rpl route-policy references

show rpl route-policy uses

show rpl unused as-path-set

show rpl unused community-set

show rpl unused extcommunity-set

show rpl unused prefix-set

show rpl unused route-policy

source in

suppress-route

tag

unsuppress route


Routing Policy Language Commands on Cisco IOS XR Software


This chapter describes the Cisco IOS XR software routing policy language (RPL) commands used to create, modify, monitor, and maintain routing policies.

For detailed information about RPL concepts, configuration tasks, and examples, see Implementing Routing Policy on Cisco IOS XR Software.

abort

To discard a route policy or set definition and return to global configuration mode, use the abort command in route-policy configuration mode.

abort

Syntax Description

This command has no arguments or keywords.

Defaults

No default behavior or values

Command Modes

Route-policy configuration
Prefix set configuration

Command History

Release
Modification

Release 3.3

This command was introduced on the Cisco CRS-1 and Cisco XR 12000 Series Router.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Task ID
Task ID
Operations

route-policy

read, write


Examples

The following example shows how to discard a route policy definition that was started and return to global configuration mode:

RP/0/RP0/CPU0:router(config)# route-policy policy_1
RP/0/RP0/CPU0:router(config-rpl)# if as-path is-local then
RP/0/RP0/CPU0:router(config-rpl-if)# abort
RP/0/RP0/CPU0:router(config)#

The following example shows how to discard a prefix set definition that was started and return to global configuration mode:

RP/0/RP0/CPU0:router(config)# prefix-set legal-ipv4-prefix-examples
RP/0/RP0/CPU0:router(config-pfx)# 10.0.1.1,
RP/0/RP0/CPU0:router(config-pfx)# 10.0.2.0/24,
RP/0/RP0/CPU0:router(config-pfx)# abort
RP/0/RP0/CPU0:router(config)#

Related Commands

Command
Description

prefix-set

Enters prefix set configuration mode and defines a prefix set.


add

To add an offset to an existing value, use the add command in route-policy configuration mode.

add {eigrp-metric bandwidth | rip-metric {number | parameter}}

Syntax Description

eigrp-metric

Enhanced Interior Gateway Routing Protocol (EIGRP) metric attribute.

bandwidth

Bandwidth in kilobits per second. Range is from 0 to 4294967295.

rip-metric

Routing Information Protocol (RIP) metric attribute.

number

Value assigned to a four-bit unsigned integer. Range is from 0 to 16.

parameter

Parameter name. The parameter name must be preceded with a "$."


Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 3.3

This command was introduced on the Cisco CRS-1 and Cisco XR 12000 Series Router.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Task ID
Task ID
Operations

route-policy

read, write


Examples

The following example shows how to add 1000 kilobits per second to the EIGRP metric:

RP/0/RP0/CPU0:router(config)# route-policy policy_1
RP/0/RP0/CPU0:router(config-rpl)# add eigrp-metric 1000
RP/0/RP0/CPU0:router(config-rpl)# end-policy

apply

To execute a parameterized or unparameterized policy from within another policy, use the apply command in route-policy configuration mode.

apply name [parameter1, parameter2, . . . , parameterN]

Syntax Description

name

Name of a route policy.

parameter

(Optional) Parameter name.


Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 2.0

This command was introduced on the Cisco CRS-1.

Release 3.0

No modification.

Release 3.2

This command was supported on the Cisco XR 12000 Series Router.

Release 3.3

No modification.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the apply command to execute a policy (either parameterized or unparameterized) from within another policy, which allows for the reuse of common blocks of policy.

Task ID
Task ID
Operations

route-policy

read, write


Examples

In the following example, the policy CustomerIn applies the route-policy SetLocalPref to conditionally set the local preference on a route. The parameters 20, 30, 40, and 50 are passed to the parameterized policy SetLocalPref, where the local preference is set to:

20, if the community 217:20 is present in the route

30, if the community 217:30 is present in the route

40, if the community 217:40 is present in the route

50, if the community 217:50 is present in the route

RP/0/RP0/CPU0:router(config)# route-policy CustomerIn
RP/0/RP0/CPU0:router(config-rpl)# apply SetLocalPref (20, 30, 40, 50)
RP/0/RP0/CPU0:router(config-rpl)# end-policy

RP/0/RP0/CPU0:router(config)# route-policy SetLocalPref ($lp1, $lp2, $lp3, $lp4)
RP/0/RP0/CPU0:router(config-rpl)# if community matches-any (217:$lp1) then
RP/0/RP0/CPU0:router(config-rpl-if)# set local-preference $lp1
RP/0/RP0/CPU0:router(config-rpl-elseif)# elseif community matches-any (217:$lp2) then
RP/0/RP0/CPU0:router(config-rpl-elseif)# set local-preference $lp2
RP/0/RP0/CPU0:router(config-rpl-elseif)# elseif community matches-any (217:$lp3) then
RP/0/RP0/CPU0:router(config-rpl-elseif)# set local-preference $lp3
RP/0/RP0/CPU0:router(config-rpl-elseif)# elseif community matches-any (217:$lp4) then
RP/0/RP0/CPU0:router(config-rpl-elseif)# set local-preference $lp4
RP/0/RP0/CPU0:router(config-rpl-elseif)# endif
RP/0/RP0/CPU0:router(config-rpl)# end-policy

as-path in

To match the AS path of a route to an AS path set, use the as-path in command in route-policy configuration mode.

as-path in {as-path-set-name | inline-as-path-set}

Syntax Description

as-path-set-name

Name of an AS path set.

inline-as-path-set

Name of an inline AS path set.


Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 2.0

This command was introduced on the Cisco CRS-1.

Release 3.0

No modification.

Release 3.2

This command was supported on the Cisco XR 12000 Series Router.

Release 3.3

No modification.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the as-path in command as a conditional expression within an if statement to match the AS path of a route to an AS path set. The AS path is a sequence of autonomous system numbers traversed by a route.


Note For a list of all conditional expressions available within an if statement, see the if command.


The as-path in command evaluates to true if at least one of the regular expressions defined in the associated AS path set matches the AS path attribute of the route.

In the case where the AS path set is defined but contains no elements in it, the as-path in conditional expression command returns false.

Task ID
Task ID
Operations

route-policy

read, write


Examples

For example, assume we have an AS path set named my-as-set defined as follows:

RP/0/RP0/CPU0:router(config)# as-path-set my-as-set
RP/0/RP0/CPU0:router(config-as)# ios-regex '_12$',
RP/0/RP0/CPU0:router(config-as)# ios-regex '_13$'
RP/0/RP0/CPU0:router(config-as)# end-set

and the following policy excerpt using an as-path-set-name argument:

RP/0/RP0/CPU0:router(config-rpl)# if as-path in my-as-set then
RP/0/RP0/CPU0:router(config-rpl-if)# set local-preference 100
RP/0/RP0/CPU0:router(config-rpl-if)# endif
RP/0/RP0/CPU0:router(config-rpl)#

The AS path in condition evaluates to true if one or more of the regular expression matches in the set my-as-set match the AS path associated with the route. In the case of a defined but empty AS path set, this operator returns false.

The preceding policy excerpt is equivalent to the following version, which uses an inline-as-path set variable:

RP/0/RP0/CPU0:router(config-rpl)# if as-path in (ios-regex `_12$,ios-regex `_13$') then
RP/0/RP0/CPU0:router(config-rpl-if)# set local-preference 100
RP/0/RP0/CPU0:router(config-rpl-if)# endif
RP/0/RP0/CPU0:router(config-rpl)#

as-path is-local

To determine if this router or another router within this autonomous system or confederation originated a route, use the as-path is-local command in route-policy configuration mode.

as-path is-local

Syntax Description

This command has no arguments or keywords.

Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 2.0

This command was introduced on the Cisco CRS-1.

Release 3.0

No modification.

Release 3.2

This command was supported on the Cisco XR 12000 Series Router.

Release 3.3

No modification.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the as-path is-local command as a conditional expression within an if statement to determine if this router (or another router within this autonomous system or confederation) originated the route.


Note For a list of all conditional expressions available within an if statement, see the if command.


Routes that are locally originated within the autonomous system or confederation carry an empty AS path. For the Border Gateway Protocol (BGP) specification, when a route is advertised across the autonomous system boundary or a confederation boundary, the local autonomous system number or confederation ID is appended to the autonomous system path. The AS path of a locally originated aggregate is also empty unless it has been modified by policy.

The is-local operator evaluates to true for autonomous system paths that are empty. An empty AS path is how an AS path that is local to our autonomous system is represented in BGP.

Task ID
Task ID
Operations

route-policy

read, write


Examples

In the following example, if the AS path is local, then the local preference is set to 100:

RP/0/RP0/CPU0:router(config-rpl)# if as-path is-local then
RP/0/RP0/CPU0:router(config-rpl-if)# set local-preference 100
RP/0/RP0/CPU0:router(config-rpl-if)# endif
RP/0/RP0/CPU0:router(config-rpl)#

as-path length

To compare the number of ASN in the AS path of a route, use the as-path length command in route-policy configuration mode.

as-path length {eq | is | ge | le} {number | parameter}

Syntax Description

eq | is | ge | le

Equal to; greater than or equal to; less than or equal to.

number

Value assigned to an 11-bit unsigned integer. Range is from 0 to 2047.

parameter

Parameter name. The parameter name must be preceded with a "$."


Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 2.0

This command was introduced on the Cisco CRS-1.

Release 3.0

No modification.

Release 3.2

This command was supported on the Cisco XR 12000 Series Router.

Release 3.3

No modification.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the as-path length command as a conditional expression within an if statement to perform a conditional check based on the length of the AS path.


Note For a list of all conditional expressions available within an if statement, see the if command.


This command takes either a specific integer value or a range of integer values specified with the ge and le operators. Any or all of these integers can be parameterized. The operator counts one for each autonomous system in the path. In the case where the route may be aggregated and contain one or more as-sets, the length operator adds one for each set present, the occurrence of an as-set typically indicates that this route is an aggregated route, and the aggregated route had a component route that contained one of the autonomous systems in the set. Likewise, in the case of confederations, a count of one is added for each confederation in the path or each confederation set in the path. A null AS path has a length of zero.

Task ID
Task ID
Operations

route-policy

read, write


Examples

In the following example, if the AS path length equals 10, then the local preference is set to 100:

RP/0/RP0/CPU0:router(config-rpl)# if as-path length eq 10 then
RP/0/RP0/CPU0:router(config-rpl-if)# set local-preference 100
RP/0/RP0/CPU0:router(config-rpl-if)# endif
RP/0/RP0/CPU0:router(config-rpl)#

Related Commands

Command
Description

as-path in

Matches the AS path of a route to an AS path set.

as-path originates-from

Compares an AS path against the AS sequence beginning with the AS number that originated a route

as-path passes-through

Verifies if the supplied integer or parameter appears anywhere in the AS path or if the supplied sequence of integers and parameters appears, in the same order, anywhere in the AS path.

as-path unique-length

Performs specific checks based on the length of the AS path.


as-path neighbor-is

To test to learn if the sequence of autonomous system numbers matches the path beginning with the neighboring autonomous system from which a route was heard, use the as-path neighbor-is command in route-policy configuration mode.

as-path neighbor-is as-number-list [exact]

Syntax Description

as-number-list

Numbers or parameters, enclosed in single quotation marks, that represent a sequence of autonomous system numbers. Range is 0 to 65535.

exact

(Optional) Specifies that with the exact keyword, the as-number-list value must identically match the AS path for the route; without the exact keyword, any element in the as-number-list argument matches one or more occurrences of that element in the AS path for the route.


Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 2.0

This command was introduced on the Cisco CRS-1.

Release 3.0

No modification.

Release 3.2

This command was supported on the Cisco XR 12000 Series Router.

Release 3.3

No modification.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the as-path neighbor-is command as a conditional expression within an if statement to test the autonomous system number or numbers at the head of the AS path against a sequence of one or more integral values or parameters, in other words, to test to learn if the sequence of autonomous system numbers matches the path beginning with the neighboring autonomous system from which this route was heard.


Note For a list of all conditional expressions available within an if statement, see the if command.


This command has an equivalent regular expression (ios-regex). For example, AS path neighbor-is `1' would be `^1_'.

Task ID
Task ID
Operations

route-policy

read, write


Examples

The following are incomplete configuration examples:

RP/0/RP0/CPU0:router(config-rpl)# if as-path neighbor-is '10' then 
RP/0/RP0/CPU0:router(config-rpl-if)# if as-path neighbor-is '$asnum' then 
RP/0/RP0/CPU0:router(config-rpl-if)# if as-path neighbor-is '10 20' then 

These statements evaluate to true when the first autonomous system numbers on the AS path match, in the same order, the supplied parameters or integer values in the neighbor-is statement. If the neighboring autonomous system location happens to be an AS-set, the operator evaluates to true if the corresponding argument to the neighbor-is operator is an element of the AS-set.

Without the exact keyword, repeated autonomous system numbers in the AS path are ignored. For example,

RP/0/RP0/CPU0:router(config-rpl)# if as-path neighbor-is '10 20' then

matches an AS path beginning

10 10 10 20 ...

and an AS path beginning:

10 20 ....

With the exact keyword, repetitions are not ignored, therefore

RP/0/RP0/CPU0:router(config-rpl)# if as-path neighbor-is '10 20' exact then

matches the second of these AS paths but not the first.

Related Commands

Command
Description

as-path in

Matches the AS path of a route to an AS path set.

as-path length

Compares the number of ASN in the AS path of a route.

as-path originates-from

Compares an AS path to the AS sequence beginning with the AS number that originated a route.

as-path passes-through

Verifies if the supplied integer or parameter appears anywhere in the AS path or if the supplied sequence of integers and parameters appears, in the same order, anywhere in the AS path.

as-path unique-length

Performs specific checks based on the length of the AS path.


as-path originates-from

To compare an AS path against the AS sequence beginning with the AS number that originated a route, use the as-path originates-from command in route-policy configuration mode.

as-path originates-from as-number-list [exact]

Syntax Description

as-number-list

Numbers or parameters, enclosed in single quotation marks, that represent a sequence of autonomous system numbers. Range is 0 to 65535.

exact

(Optional) Specifies that with the exact keyword, the as-number-list value must identically match the AS path for the route; without the exact keyword, any element in the as-number-list argument matches one or more occurrences of that element in the AS path for the route.


Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 2.0

This command was introduced on the Cisco CRS-1.

Release 3.0

No modification.

Release 3.2

This command was supported on the Cisco XR 12000 Series Router.

Release 3.3

No modification.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the as-path originates-from command as a conditional expression within an if statement to compare an AS path to the autonomous system sequence.


Note For a list of all conditional expressions available within an if statement, see the if command.


The originates-from operator is similar to the neighbor-is operator, except that it looks at the autonomous system number at the opposite end of the AS path. In other words, it is comparing to the autonomous system that originated the route. It can take numbers or parameters, enclosed in single quotation marks, that represent a sequence of autonomous system numbers. When more than one number is specified in the list, the sequence of autonomous system numbers listed must appear as a subsequence in the AS path, with the last number corresponding to the autonomous system that originated the route.

Task ID
Task ID
Operations

route-policy

read, write


Examples

The following are incomplete configuration examples:

RP/0/RP0/CPU0:router(config-rpl)# if as-path originates-from '10 11' then 
RP/0/RP0/CPU0:router(config-rpl-if)# if as-path originates-from '$asnum 11' then 

The first line of the preceding example evaluates to true if autonomous system 11 originated the route and then advertised it to autonomous system 10, from which the route was eventually propagated to us. In the case where the route has been aggregated, and the location of the originating autonomous system contains an AS-set, the originates-from operator evaluates to true if the argument to the originates-from operator is contained in the AS-set.

Without the exact keyword, repeated autonomous system numbers in the AS path are ignored. For example,

RP/0/RP0/CPU0:router(config-rpl)# if as-path originates-from '10 11' then

matches an autonomous system path ending

...10 10 10 11

and an autonomous system path ending

...10 11

With the exact keyword, repetitions are not ignored, therefore

RP/0/RP0/CPU0:router(config-rpl)# if as-path originates-from '10 11' exact then

matches the second of these autonomous system paths but not the first.

Related Commands

Command
Description

as-path in

Matches the AS path of a route to an AS path set.

as-path length

Compares the number of ASN in the AS path of a route

as-path passes-through

Verifies if the supplied integer or parameter appears anywhere in the AS path or if the supplied sequence of integers and parameters appears, in the same order

as-path unique-length

Performs specific checks based on the length of the AS path.


as-path passes-through

To verify if the supplied integer or parameter appears anywhere in the AS path or if the supplied sequence of integers and parameters appears, in the same order, anywhere in the AS path, use the as-path passes-through command in route-policy configuration mode.

as-path passes-through as-number-list [exact]

Syntax Description

as-number-list

Numbers or parameters, enclosed in single quotation marks, that represent a sequence of autonomous system numbers. Range is 0 to 65535.

exact

(Optional) Specifies that with the exact keyword, the as-number-list value must identically match the AS path for the route; without the exact keyword, any element in the as-number-list argument matches one or more occurrences of that element in the AS path for the route.


Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 2.0

This command was introduced on the Cisco CRS-1.

Release 3.0

No modification.

Release 3.2

This command was supported on the Cisco XR 12000 Series Router.

Release 3.3

No modification.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the as-path passes-through command as a conditional expression within an if statement to verify if the specified integer or parameter appears anywhere in the AS path or if the sequence of integers and parameters appears.


Note For a list of all conditional expressions available within an if statement, see the if command.


The passes-through operator takes a sequence of integers or parameters, enclosed in single quotation marks, as an argument. It can also take a single integer or parameter as an argument. It evaluates to true if the supplied integer or parameter appears anywhere in the AS path, or if the supplied sequence of integers and parameters appears, in the same order, anywhere in the AS path. This includes the originates-from or neighbor-is location in the AS path.

Task ID
Task ID
Operations

route-policy

read, write


Examples

The following are incomplete configuration examples:

RP/0/RP0/CPU0:router(config-rpl)# if as-path passes-through '10' then 
RP/0/RP0/CPU0:router(config-rpl-if)# if as-path passes-through '$asnum' then 
RP/0/RP0/CPU0:router(config-rpl-if)# if as-path passes-through '10 11' then 
RP/0/RP0/CPU0:router(config-rpl-if)# if as-path passes-through '10 $asnum 12' then 

Without the exact keyword, repeated autonomous system numbers in the AS path are ignored. For example:

RP/0/RP0/CPU0:router(config-rpl)# if as-path passes-through '9 10 11' then

matches an AS path containing

...9 10 10 10 11 ....

and an AS path containing:

...9 10 11...

With the exact keyword, repetitions are not ignored. Therefore:

RP/0/RP0/CPU0:router(config-rpl)# if as-path passes-through '9 10 11' exact then

matches the second of these AS paths but not the first.

Related Commands

Command
Description

as-path in

Matches the AS path of a route to an AS path set.

as-path length

Compares the number of ASN in the AS path of a route

as-path originates-from

Compares an AS path to the AS sequence beginning with the AS number that originated a route.

as-path unique-length

Performs specific checks based on the length of the AS path.


as-path-set

To create a named AS path set, use the as-path-set command in global configuration mode. To remove the named AS path set, use the no form of this command.

as-path-set name

no as-path-set name

Syntax Description

name

Name of the AS path set.


Defaults

No default behavior or values

Command Modes

Global configuration

Command History

Release
Modification

Release 2.0

This command was introduced on the Cisco CRS-1.

Release 3.0

No modification.

Release 3.2

This command was supported on the Cisco XR 12000 Series Router.

Release 3.3

No modification.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the as-path-set command to create a named AS path set.

An AS path set comprises operations for matching an AS path attribute.

This command enters AS path set configuration mode, in which you can use the ios-regex keyword to indicate the type of regular expression. Single quotation marks are required around the regular expression.

The inline set form is a parenthesized list of comma-separated expressions.

See the "Understanding Regular Expressions, Special Characters and Patterns" appendix in Cisco IOS XR Getting Started Guide for information about forming regular expressions.

Task ID
Task ID
Operations

route-policy

read, write


Examples

The following is a sample definition of an AS path set named aset1:

RP/0/RP0/CPU0:router(config)# as-path-set aset1
RP/0/RP0/CPU0:router(config-as)# ios-regex '_42$',
RP/0/RP0/CPU0:router(config-as)# ios-regex '_127$'
RP/0/RP0/CPU0:router(config-as)# end-set

This AS path set is composed of two elements. When used in a matching operation, this AS path set matches any route whose AS path ends with either the autonomous system number 42 or 127.

The following is a sample of an inline set:

RP/0/RP0/CPU0:router(config-rpl)# if as-path in (ios-regex '_42$', ios-regex$ '_127$')
RP/0/RP0/CPU0:router(config-rpl-if)# pass 
RP/0/RP0/CPU0:router(config-rpl-if)# endif 
RP/0/RP0/CPU0:router(config-rpl)#

as-path unique-length

To perform specific checks based on the length of the AS path, use the as-path unique-length command in route-policy configuration mode.

as-path unique-length {eq | is | ge | le} {number | parameter}

Syntax Description

eq | is | ge | le

Equal to; greater than or equal to; less than or equal to.

number

Value assigned to an 11-bit unsigned integer. Range is from 0 to 2047.

parameter

Parameter name. The parameter name must be preceded with a "$."


Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 2.0

This command was introduced on the Cisco CRS-1.

Release 3.0

No modification.

Release 3.2

This command was supported on the Cisco XR 12000 Series Router.

Release 3.3

No modification.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the as-path unique-length command as a conditional expression within an if statement to perform a check based on the length of the AS path.


Note For a list of all conditional expressions available within an if statement, see the if command.


The unique-length operator is similar to the length operator, except that when an AS path has been padded with the same autonomous system number multiple times, the operator counts only one when the route is padded. Therefore, given an AS path of 333 333 111 222 123 444 444 444, the unique-length operator would return a value of 5, whereas the length operator would return a value of 8.

Task ID
Task ID
Operations

route-policy

read, write


Examples

The following example shows show to perform checks based on the AS path length. If the AS path matches the specified values, the local preference is set to 100:

RP/0/RP0/CPU0:router(config-rpl)# if as-path unique-length eq 10 then 
RP/0/RP0/CPU0:router(config-rpl-if)# if as-path unique-length ge 10 then 
RP/0/RP0/CPU0:router(config-rpl-if)# if as-path unique-length le 10 then 

RP/0/RP0/CPU0:router(config-rpl)# if as-path unique-length eq $integerparam then 
RP/0/RP0/CPU0:router(config-rpl-if)# if as-path unique-length ge $geparam then 
RP/0/RP0/CPU0:router(config-rpl-if)# if as-path unique-length le $leparam then 

RP/0/RP0/CPU0:router(config-rpl)# set local-preference 100
RP/0/RP0/CPU0:router(config-rpl)# endif

Related Commands

Command
Description

as-path length

Performs conditional checks based on the length of the AS path.


community is-empty

To learn if a route has no community attributes associated with it, use the community is-empty command in route-policy configuration mode.

community is-empty

Syntax Description

This command has no arguments or keywords.

Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 2.0

This command was introduced on the Cisco CRS-1.

Release 3.0

No modification.

Release 3.2

This command was supported on the Cisco XR 12000 Series Router.

Release 3.3

No modification.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the community is-empty command as a conditional expression within an if statement to learn if a route has community attributes associated with it.


Note For a list of all conditional expressions available within an if statement, see the if command.


This command takes no arguments and evaluates to true only if the route has no community attributes associated with it.

Task ID
Task ID
Operations

route-policy

read, write


Examples

In the following example, if the route has no community attributes associated with it, then the local preference is set to 100:

RP/0/RP0/CPU0:router(config-rpl)# if community is-empty then
RP/0/RP0/CPU0:router(config-rpl-if)# set local-preference 100
RP/0/RP0/CPU0:router(config-rpl-if)# endif
RP/0/RP0/CPU0:router(config-rpl)#

community matches-any

To match any elements of a community set, use the community matches-any command in route-policy configuration mode.

community matches-any {community-set-name | inline-community-set}

Syntax Description

community-set-name

Name of a community set.

inline-community-set

Inline community set.


Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 2.0

This command was introduced on the Cisco CRS-1.

Release 3.0

No modification.

Release 3.2

This command was supported on the Cisco XR 12000 Series Router. The BGP community matching operators were enhanced to allow comparisons on ranges and regular expressions.

Release 3.3

No modification.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the community matches-any command as a conditional expression within an if statement to match any element of a community set.


Note For a list of all conditional expressions available within an if statement, see the if command.


A simple condition using the matches-any operator evaluates as true if at least one community element of the community attribute for the route matches an element in the community set operand. If no community in the route matches any of the specifications in the named or inline set, then the condition evaluates to false. Likewise, when there is no community at all in the route, the condition evaluates to false.

Matching of a community in the route to a specification in a named or an inline set is intuitive. If the community specification in a set is the familiar colon-separated decimal 16-bit numbers specification, or one of the well-known communities, the community matches the specification if the specification denotes the same 32-bit number as that in the route. If the community specification uses a wildcard, then the community in the route matches if it is one of the many communities denoted by the wildcard specification. In inline sets, community specifications may be parameterized, in which case the relevant matching is done when the value of the parameter has been supplied.

Communities may also be matched using range and regular expression operators. Range specifications are entered as follows: [low-value..high-value]. Either or both colon-separated halves of a community value may contain a range. The following are valid range specifications:

10:[100..1000]
[10..100]:80
[10..100]:[100..2000]

In addition, the private-as keyword may be used to specify the range from 64512 to 65534. Regular expressions are specified as the ios-regex keyword followed by a valid regular expression string.

Community values from the route are matched one at a time to the match specifications. Therefore, regex match specifications are expected to represent one individual community value and not a sequence of community values.

Task ID
Task ID
Operations

route-policy

read, write


Examples

In the following example, a named community set called my-community-set and a route policy called community-matches-any-example are created. The policy sets the local-preference to 100 for any route that has one or more of the communities in the my-community-set community set. If the route does not have any of these communities, the policy checks whether it has any communities whose first half is in the range from 10 to 25 and whose second half is the value 35, in which case it sets the local-preference to 200. Otherwise, it checks for a community value in the range of 30:100 to 30:500, in which case it sets the local-preference to 300.

RP/0/RP0/CPU0:router(config)# community-set my-community-set
RP/0/RP0/CPU0:router(config-comm)# 10:20,
RP/0/RP0/CPU0:router(config-comm)# 10:30,
RP/0/RP0/CPU0:router(config-comm)# 10:40
RP/0/RP0/CPU0:router(config-comm)# end-set

RP/0/RP0/CPU0:router(config)# route-policy community-matches-any-example
RP/0/RP0/CPU0:router(config-rpl)# if community matches-any my-community-set then
RP/0/RP0/CPU0:router(config-rpl-if)# set local-preference 100
RP/0/RP0/CPU0:router(config-rpl-if)# elseif community matches-any ([10..25]:35) then
RP/0/RP0/CPU0:router(config-rpl-elseif)# set local-preference 200
RP/0/RP0/CPU0:router(config-rpl-elseif)# elseif community matches-any (30:[100..500]) then
RP/0/RP0/CPU0:router(config-rpl-elseif)# set local-preference 300
RP/0/RP0/CPU0:router(config-rpl-elseif)# endif
RP/0/RP0/CPU0:router(config-rpl)# end-policy

Related Commands

Command
Description

community matches-every

Matches every element of a community set.


community matches-every

To match every element of a community set, use the community matches-every command in route-policy configuration mode.

community matches-every {community-set-name | inline-community-set}

Syntax Description

community-set-name

Name of a community set.

inline-community-set

Inline community set.


Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 2.0

This command was introduced on the Cisco CRS-1.

Release 3.0

No modification.

Release 3.2

This command was supported on the Cisco XR 12000 Series Router. The BGP community matching operators were enhanced to allow comparisons on ranges and regular expressions.

Release 3.3

No modification.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the community matches-every command as a conditional expression within an if statement to match every element of a community set.


Note For a list of all conditional expressions available within an if statement, see the if command.


A simple condition using the matches-every operator evaluates as true if every specification in the named set or inline set specified matches at least one community value in the route. If any community specification in the named or inline set is not matched, then the operation evaluates to false.

Matching of a community in the route to a specification in a named or an inline set is intuitive. If the community-specification in a set is the familiar colon-separated decimal 16-bit numbers specification, or one of the well-known communities, the community matches the specification if the specification denotes the same 32-bit number as that in the route. If the community specification uses a wildcard, then the community in the route matches if it is one of the many communities denoted by the wildcard specification. In inline sets, community specifications may be parameterized, in which case the relevant matching is done when the value of the parameter has been supplied.

Communities may also be matched using range and regular expression operators. Range specifications are entered as follows: [low-value..high-value]. Either or both colon-separated halves of a community value may contain a range. The following are valid range specifications:

10:[100..1000]
[10..100]:80
[10..100]:[100..2000]

Therefore, a matches-every operation with two community range specifications means that a community must be present in the route that corresponds to each range. For example, in the following statement:

if community matches-every (10:[100..200],20:[100..200]) then

the statement evaluates as true if one or more communities in the route lie in the range 10:[100.200] and one or more communities in the route lie in the range 20:[100..200].

In addition, the private-as keyword may be used to specify the range from 64512 to 65534.

Regular expressions are specified as the ios-regex keyword followed by a valid single-quoted regular expression string. Community values from the route are matched one at a time against the match specifications. Therefore, regex match specifications are expected to represent one individual community value and not a sequence of community values.

Task ID
Task ID
Operations

route-policy

read, write


Examples

In the following example, the route policy named community-matches-every-example sets the local-preference value to 100 for all routes that have all three communities in the my-community-set community set. Routes that do not have all three communities but have a community that matches the first regular expression match have the local-preference value set to 200. Finally, any remaining routes that match the last regular expression have the local-preference values set to 300.

RP/0/RP0/CPU0:router(config)# community-set my-community-set
RP/0/RP0/CPU0:router(config-comm)# 10:20,
RP/0/RP0/CPU0:router(config-comm)# 10:30,
RP/0/RP0/CPU0:router(config-comm)# 10:40
RP/0/RP0/CPU0:router(config-comm)# end-set

RP/0/RP0/CPU0:router(config)# route-policy community-matches-every-example
RP/0/RP0/CPU0:router(config-rpl)# if community matches-every my-community-set then
RP/0/RP0/CPU0:router(config-rpl-if)# set local-preference 100
RP/0/RP0/CPU0:router(config-rp-elseif)# elseif community matches-every (ios-regex 
'_10:[0-9]0_') then
RP/0/RP0/CPU0:router(config-rpl-elseif)# set local-preference 200
RP/0/RP0/CPU0:router(config-rpl-elseif)# elseif community matches-every 
(ios-regex'_20:[0-9]0_') then
RP/0/RP0/CPU0:router(config-rpl-elseif)# set local-preference 300
RP/0/RP0/CPU0:router(config-rpl-elseif)# endif
RP/0/RP0/CPU0:router(config-rpl)# end-policy

Related Commands

Command
Description

community matches-any

Matches any element of a community set.


community-set

To define a community set, use the community-set command in global configuration mode. To remove the community set, use the no form of this command.

community-set name

no community-set name

Syntax Description

name

Name of the community set.


Defaults

No default behavior or values

Command Modes

Global configuration

Command History

Release
Modification

Release 2.0

This command was introduced on the Cisco CRS-1.

Release 3.0

No modification.

Release 3.2

This command was supported on the Cisco XR 12000 Series Router.

Release 3.3

No modification.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Regular expressions and ranges can be specified in a community set to support the matching or deleting of communities using ranges or regular expressions in named community sets. An attempt to use a community set that contains a range or regular expression to set a community value is rejected when an attempt to attach such a policy is made.

A community set holds community values for matching against the Border Gateway Protocol (BGP) community attribute. A community is a 32-bit quantity. For notational convenience, each community value must be split in half and expressed as two unsigned decimal integers in the range from 0 to 65535, separated by a colon.

The inline form of a community set also supports parameterization. Each 16-bit portion of the community may be parameterized.

The routing policy language (RPL) provides symbolic names for the standard well-known community values: internet is 0:0, no-export is 65535:65281, no-advertise is 65535:65282, and local-as is 65535:65283.

RPL also provides a facility for using wildcards in community specifications. A wildcard is specified by inserting an asterisk (*) in place of one of the 16-bit portions of the community specification, which indicates that any value for that portion of the community matches.

Every community set must contain at least one community value. An empty community set is invalid and the policy configuration system rejects it.

Task ID
Task ID
Operations

route-policy

read, write


Examples

In the following example, a community set named cset1 is created:

RP/0/RP0/CPU0:router(config)# community-set cset1
RP/0/RP0/CPU0:router(config-comm)# 12:34,
RP/0/RP0/CPU0:router(config-comm)# 12:56,
RP/0/RP0/CPU0:router(config-comm)# 12:78,
RP/0/RP0/CPU0:router(config-comm)# internet
RP/0/RP0/CPU0:router(config-comm)# end-set

In the following example, a community set named cset2 is created:

RP/0/RP0/CPU0:router(config)# community-set cset2
RP/0/RP0/CPU0:router(config-comm)# 123:456,
RP/0/RP0/CPU0:router(config-comm)# no-advertise,
RP/0/RP0/CPU0:router(config-comm)# end-set

In the following example, a community set named cset3 is created. This policy uses wildcards and matches all communities where the autonomous system part of the community is 123.

RP/0/RP0/CPU0:router(config)# community-set cset3
RP/0/RP0/CPU0:router(config-comm)# 123:*
RP/0/RP0/CPU0:router(config-comm)# end-set

delete community

To delete community values from a community list in a route, use the delete community command in route-policy configuration mode.

delete community {all | in {community-set-name | inline-community-set} | not in {community-set-name | inline-community-set}}

Syntax Description

all

Removes all communities except the well-known communities.

in

Removes any communities associated with the route that are listed in either the named community set or the inline community set.

community-set-name

Name of a community set.

inline-community-set

Inline community set.

not in

Removes all communities that are not listed in either the named community set or the inline community set, and are not well-known communities.


Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 2.0

This command was introduced on the Cisco CRS-1.

Release 3.0

No modification.

Release 3.2

This command was supported on the Cisco XR 12000 Series Router. The BGP community deletion operations were extended to allow communities that match a range specification or a regular expression to be deleted.

Release 3.3

No modification.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the delete community command to delete community values from a community list in a route.


Note The delete community command can be used as an action statement within an if statement. For a list of all action statements available within an if statement, see the if command.


Communities are 32-bit values carried in Border Gateway Protocol (BGP) routes. Each route may have zero or more communities in an unordered list.

You can remove a well-known community (internet, no-export, no-advertise, or local-as) from a route, but this removal must be done explicitly. This command should be used with a degree of caution. In general, few circumstances exist in which you would need to remove a well-known community.

Task ID
Task ID
Operations

route-policy

read, write


Examples

The following example shows how to delete any communities associated with the routes that are listed in either the named community set or inline community set, respectively.

RP/0/RP0/CPU0:router(config-rpl)# delete community in my_community_set
RP/0/RP0/CPU0:router(config-rpl)# delete community in (10:[0..50],20:[60..80])

The following example shows how to remove all communities except for the well-known communities.

RP/0/RP0/CPU0:router(config-rpl)# delete community all

The following example shows how to delete the well-known community value internet from a route:

RP/0/RP0/CPU0:router(config-rpl)# delete community in (internet)

delete extcommunity rt

To delete extended community values from a BGP route target extended community list in a route, use the delete extcommunity rt command in route-policy configuration mode.

delete extcommunity rt {all | in {extcommunity-set-name | inline-extcommunity-set} | not in {extcommunity-set-name | inline-extcommunity-set}}

Syntax Description

all

Removes all extended communities.

in

Removes any extended communities associated with the routes that are listed in either the named extended community set or the inline extended community set.

extcommunity-set-name

Name of an extended community set.

inline-extcommunity-set

Inline extended community set.

not in

Removes all extended communities that are not listed in either the named extended community set or the inline extended community set, and are not well-known extended communities.


Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 2.0

This command was introduced on the Cisco CRS-1.

Release 3.0

No modification.

Release 3.2

This command was supported on the Cisco XR 12000 Series Router.

Release 3.3

No modification.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the delete extcommunity rt command to delete extended community values from a BGP route target extended community list in a route.


Note The delete extcommunity rt command can be used as an action statement within an if statement. For a list of all action statements available within an if statement, see the if command.


Extended communities are similar to regular Border Gateway Protocol (BGP) communities but contain more data and have a richer structure for encoding information in them.

Extended communities can be in the following forms: SoO:AS:tag, SoO:IP:tag, RT:AS:tag, or RT:IP:tag.

Wildcards (*) are not allowed for extended community set elements.

The forms of this command that take a named extended community set or an inline extended community set value as arguments are equivalent. They delete any extended communities that are listed in either the named set or the inline set, respectively.

Task ID
Task ID
Operations

route-policy

read, write


Examples

In the following example, all extended communities are deleted:

RP/0/RP0/CPU0:router(config-rpl)# delete extcommunity rt all

In this example, any extended communities that are listed in my-extcommunity-set are deleted:

RP/0/RP0/CPU0:router(config-rpl)# delete extcommunity rt in my-extcommunity-set

In this example, extended communities associated with the route listed in the named inline extended community sets are deleted:

RP/0/RP0/CPU0:router(config-rpl)# delete extcommunity rt in (RT:67:29, RT:67:55)

destination in

To match a destination entry in a named prefix set or inline prefix set, use the destination in command in route-policy configuration mode.

destination in {prefix-set-name | inline-prefix-set}

Syntax Description

prefix-set-name

Name of a prefix set.

inline-prefix-set

Inline prefix set.


Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 2.0

This command was introduced on the Cisco CRS-1.

Release 3.0

No modification.

Release 3.2

This command was supported on the Cisco XR 12000 Series Router.

Release 3.3

No modification.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the destination in command as a conditional expression within an if statement to match a destination entry in a named prefix set or inline prefix set.


Note For a list of all conditional expressions available within an if statement, see the if command.


This command takes either a named prefix set or an inline prefix set value as an argument. The condition returns true if the destination entry matches any entry in the prefix set or inline prefix set. An attempt to match a destination using a prefix set that is defined but contains no elements returns false.

The destination of a route is also known in Border Gateway Protocol (BGP) as its network-layer reachability information (NLRI). It comprises a prefix value and a mask length. The routing policy language (RPL) provides the ability to test destinations for a match to a list of prefix match specifications using the in operator.

RPL supports both 32-bit IPv4 prefixes, specified in dotted-decimal format, and 128-bit IPv6 prefixes, specified in colon-separated hexadecimal format.

Task ID
Task ID
Operations

route-policy

read, write


Examples

In the following example, a prefix set named my-prefix-set is defined and a route policy named use-destination-in is created. Within the use-destination-in route policy, the destination in command is used within an if statement to learn if the destination is in the prefix-set named my-prefix-set. If it is, then local preference is set to 100. If it is not in my-prefix-set but does match the next prefix specifications, then local preference is set to 200.

RP/0/RP0/CPU0:router(config)# prefix-set my-prefix-set
RP/0/RP0/CPU0:router(config-pfx)# 10.0.0.1/32,
RP/0/RP0/CPU0:router(config-pfx)# fe80::203:0:0:0/64,
RP/0/RP0/CPU0:router(config-pfx)# 10.0.0.2/24 le 32
RP/0/RP0/CPU0:router(config-pfx)# end-set

RP/0/RP0/CPU0:router(config)# route-policy use-destination-in
RP/0/RP0/CPU0:router(config-rpl)# if destination in my-prefix-set then
RP/0/RP0/CPU0:router(config-rpl-if)# set local-preference 100
RP/0/RP0/CPU0:router(config-rpl-if)# elseif destination in (10.0.0.1/32, 10.0.0.2/24 le 
32) then
RP/0/RP0/CPU0:router(config-rpl-elseif)# set local-preference 200
RP/0/RP0/CPU0:router(config-rpl-elseif)# endif
RP/0/RP0/CPU0:router(config-rpl)# end-policy

In the following example, a prefix set named ipv6-prefix-set is defined and a route policy named ipv6-destination-in is created. Within the ipv6-destination-in route policy, the destination in command is used within an if statement to learn if the destination is in the prefix-set named ipv6-prefix-set. If it is, then the next hop is set to 2001:abcd:fedc::1. If it is not in ipv6-prefix-set but does match the next prefix specifications, then the next hop is set to 1111:2222:3333:4444:5555:6666:7777:8888.

RP/0/RP0/CPU0:router(config)# prefix-set ipv6-prefix-set
RP/0/RP0/CPU0:router(config-pfx)# 2001:0:0:1::/64,
RP/0/RP0/CPU0:router(config-pfx)# 2001:0:0:2::/64,
RP/0/RP0/CPU0:router(config-pfx)# 2001:0:0:3::/64,
RP/0/RP0/CPU0:router(config-pfx)# 2001:0:0:4::/64
RP/0/RP0/CPU0:router(config-pfx)# end-set

RP/0/RP0/CPU0:router(config)# route-policy ipv6-destination-in
RP/0/RP0/CPU0:router(config-rpl)# if destination in ipv6-prefix-set then
RP/0/RP0/CPU0:router(config-rpl-if)# set next-hop 2001:abcd:fedc::1
RP/0/RP0/CPU0:router(config-rpl-if)# elseif destination in (2001::1, 2002:1:2:3::/64) then
RP/0/RP0/CPU0:router(config-rpl-elseif)# set next-hop 
1111:2222:3333:4444:5555:6666:7777:8888
RP/0/RP0/CPU0:router(config-rpl-elseif)# endif
RP/0/RP0/CPU0:router(config-rpl)# end-policy

drop

To discard a route, use the drop command in route-policy configuration mode.

drop

Syntax Description

This command has no arguments or keywords.

Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 2.0

This command was introduced on the Cisco CRS-1.

Release 3.0

No modification.

Release 3.2

This command was supported on the Cisco XR 12000 Series Router.

Release 3.3

No modification.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the drop command within a route policy to drop a route.


Note The drop command can be used as an action statement within an if statement. For a list of all action statements available within an if statement, see the if command.


This command signifies to the engine that executes policy that the action to take is to discard the route. After a route is dropped, no further execution of policy occurs. Therefore, if after executing the first two statements of a policy the drop statement is encountered, the route is discarded and execution stops immediately even when the policy contains further statements.


Note The default action of a route policy is to drop or discard any routes that have not been either explicitly passed or attempted to be modified with an action. The routing policy language (RPL) does not have specific "match clauses," which means the default drop behavior is controlled by whether a route has been explicitly passed or an attempt has been to modify the route using an action statement.


Task ID
Task ID
Operations

route-policy

read, write


Examples

In the following example, any route with a destination address contained within the prefix set pset1 is dropped:

RP/0/RP0/CPU0:router(config-rpl)# if destination in pset1 then
RP/0/RP0/CPU0:router(config-rpl-if)# drop
RP/0/RP0/CPU0:router(config-rpl-if)# endif
RP/0/RP0/CPU0:router(config-rpl)#

edit

To edit the contents of a route policy, a prefix set, an AS path set, a community set, or an extended community set, use the edit command in EXEC mode.

edit {{route-policy | prefix-set | as-path-set | community-set | extended-community-set} emacs | vim} name

Syntax Description

route-policy

Edits the contents of a route policy.

prefix-set

Edits the contents of a prefix set.

as-path-set

Edits the contents of an AS path set.

community-set

Edits the contents of a community set.

extended-community-set

Edits the contents of an extended community set.

emacs

Uses Micro Emacs editor.

vim

Uses VI Improved editor.

name

Name of a route policy, a prefix set, an AS path set, a community set, or an extended community set.


Defaults

Default editor is Micro Emacs

Command Modes

EXEC

Command History

Release
Modification

Release 2.0

This command was introduced on the Cisco CRS-1.

Release 3.0

No modification.

Release 3.2

This command was supported on the Cisco XR 12000 Series Router.

Release 3.3

Added vim keyword.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the edit command to edit the contents of a route policy, a prefix set, an AS path set, a community set, or an extended community set.

After editing with Emacs, save the editor buffer by using the Ctrl-x and Ctrl-s keystrokes. To save and exit the editor, use the Ctrl-x and Ctrl-c keystrokes.

After editing with Vim, to write to a current file and exit use the :wq or :x or ZZ keystrokes. To quit and confirm, use the :q keystrokes. To quit and discard changes, use the :q! keystrokes.

Task ID
Task ID
Operations

route-policy

read, write


Examples

In the following example, the policy_A policy is opened in the editor:

RP/0/RP0/CPU0:router# edit route-policy policy_A
----------------------------------------
== MicroEMACS 3.8b () == rpl_edit.139281 ==
  if destination in (2001::/8) then
    drop
  endif
end-policy
!

== MicroEMACS 3.8b () == rpl_edit.139281 ==
Parsing.
83 bytes parsed in 1 sec (82)bytes/sec
Committing.
1 items committed in 1 sec (0)items/sec
Updating.
Updated Commit database in 1 sec

RP/0/RP0/CPU0:router#

If there are parse errors, you are asked whether editing should continue:

RP/0/RP0/CPU0:router#edit route-policy policy_B
== MicroEMACS 3.8b () == rpl_edit.141738
route-policy policy_B
 set metric-type type_1
 if destination in (2001::/8) then
    drop
  endif  
end-policy
!
== MicroEMACS 3.8b () == rpl_edit.141738 ==
Parsing.
105 bytes parsed in 1 sec (103)bytes/sec

% Syntax/Authorization errors in one or more commands.!! CONFIGURATION 
FAILED DUE TO SYNTAX/AUTHORIZATION ERRORS
 set metric-type type_1
 if destination in (2001::/8) then
    drop
  endif
end-policy
!

Continue editing? [no]:

If you answer yes, the editor continues on the text buffer from where you left off. If you answer no, the running configuration is not changed and the editing session is ended.

After the policy is opened, it may be manipulated using normal editor commands, then saved and committed to the running configuration.

end-policy

To end the definition of a route policy and exit route-policy configuration mode, use the end-policy command in route-policy configuration mode.

end-policy

Syntax Description

This command has no arguments or keywords.

Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 2.0

This command was introduced on the Cisco CRS-1.

Release 3.0

No modification.

Release 3.2

This command was supported on the Cisco XR 12000 Series Router.

Release 3.3

No modification.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the end-policy command to end the definition of a route policy and exit route-policy configuration mode.

Task ID
Task ID
Operations

route-policy

read, write


Examples

In the following example, the end-policy command ends the definition of a route policy:

RP/0/RP0/CPU0:router(config)# route-policy med-to-local-pref
RP/0/RP0/CPU0:router(config-rpl)# if med eq 150 then
RP/0/RP0/CPU0:router(config-rpl-if)# set local-preference 10
RP/0/RP0/CPU0:router(config-rpl-if)# elseif med eq 200 then
RP/0/RP0/CPU0:router(config-elseif)# set local-preference 60
RP/0/RP0/CPU0:router(config-elseif)# elseif med eq 250 then
RP/0/RP0/CPU0:router(config-elseif)# set local-preference 0
RP/0/RP0/CPU0:router(config-elseif)# endif
RP/0/RP0/CPU0:router(config-rpl)# end-policy

end-set

To end the definition of an AS path set, a prefix set, a community set, an extended community set, or an RD set and return to global configuration mode, use the end-set command in route-policy configuration mode.

end-set

Syntax Description

This command has no arguments or keywords.

Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 2.0

This command was introduced on the Cisco CRS-1.

Release 3.0

No modification.

Release 3.2

This command was supported on the Cisco XR 12000 Series Router.

Release 3.3

Added support functionality for the rd-set command.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the end-set command to end the definition of an AS path set, a prefix set, a community set, or an extended community set.

Task ID
Task ID
Operations

route-policy

read, write


Examples

In the following example, the end-set command ends the definition of an AS path set named aset1:

RP/0/RP0/CPU0:router(config)# as-path-set aset1
RP/0/RP0/CPU0:router(config-as)# ios-regex '_42$',
RP/0/RP0/CPU0:router(config-as)# ios-regex '_127$'
RP/0/RP0/CPU0:router(config-as)# end-set 
RP/0/RP0/CPU0:router(config)# 

The following example shows how to create an RD set called my_rd_set and use the end-set command to end the definition:

RP/0/RP0/CPU0:router(config)# rd-set my_rd_set
RP/0/RP0/CPU0:router(config-rd)# 172.16.0.0/16:*,
RP/0/RP0/CPU0:router(config-rd)# 172.17.0.0/16:100,
RP/0/RP0/CPU0:router(config-rd)# 192:*,
RP/0/RP0/CPU0:router(config-rd)# 192:100
RP/0/RP0/CPU0:router(config-rd)# end-set

extcommunity rt is-empty

To test to learn if a Border Gateway Protocol (BGP) route target (RT) has extended community attributes associated with it, use the extcommunity rt is-empty command in route-policy configuration mode.

extcommunity rt is-empty

Syntax Description

This command has no arguments or keywords.

Defaults

No default behavior or value

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 3.3

This command was introduced on the Cisco CRS-1 and Cisco XR 12000 Series Router.

 

This command replaced the extcommunity is-empty command.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the extcommunity rt is-empty command as a conditional expression within an if statement to learn if a BGP route has extended community attributes associated with it.


Note For a list of all conditional expressions available within an if statement, see the if command.


The is-empty operator takes no arguments and evaluates to true if the route has no extended community attributes associated with it.

Task ID
Task ID
Operations

route-policy

read, write


Examples

In the following example, if the extended community is empty, then the local preference is set to 100:

RP/0/RP0/CPU0:router(config)# route-policy extcommunity-is-empty-example
RP/0/RP0/CPU0:router(config-rpl)# if extcommunity rt is-empty then
RP/0/RP0/CPU0:router(config-rpl-if)# set local-preference 100
RP/0/RP0/CPU0:router(config-rpl-if)# endif
RP/0/RP0/CPU0:router(config-rpl)# end-policy

extcommunity rt matches-any

To match any element of a Border Gateway Protocol (BGP) route target (RT) extended community set, use the extcommunity rt matches-any command in route-policy configuration mode.

extcommunity rt matches-any {extcommunity-set-name | inline-extcommunity-set}

Syntax Description

extcommunity-set-name

Name of an extended community set.

inline-extcommunity-set

Inline extended community set.


Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 3.3

This command was introduced on the Cisco CRS-1 and Cisco XR 12000 Series Router.

 

This command replaced the extcommunity matches-any command.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the extcommunity rt matches-any command as a conditional expression within an if statement to match elements of an extended community set.


Note For a list of all conditional expressions available within an if statement, see the if command.


A simple condition using the matches-any operator evaluates as true if at least one extended community in the route matches an extended community specification in the named or inline set. If no extended community in the route matches any of the specifications in the named or inline set, then this simple condition evaluates to false. Likewise, when there is no extended community at all in the route, the condition evaluates to false.

Matching an extended community in the route to a specification in a named or an inline set is intuitive. Because there is no use of wildcards with extended communities, a community in the route matches a specification in the set if the extended communities in the route and the inline set both encode the same 64-bit number. In inline sets, extended community specifications may be parameterized, in which case the relevant matching is done when the value of the parameter has been supplied.

Task ID
Task ID
Operations

route-policy

read, write


Examples

In the following example, an extended community set named my-extcommunity-set and a parameterized route-policy named my-extcommunity-set-example($tag,$ip) are defined. The extcommunity rt matches-any command is used in an if statement such that if at least one extended community in the route matches an extended community specification in the named set, then the local preference is set to 100. If there is no extended community in the route that matches any of the specifications in the named set, then the condition evaluates as false and the extended community is compared to the inline extended sets.

RP/0/RP0/CPU0:router(config)# extcommunity-set rt my-extcommunity-set
RP/0/RP0/CPU0:router(config-ext)# 10:615,
RP/0/RP0/CPU0:router(config-ext)# 10:6150,
RP/0/RP0/CPU0:router(config-ext)# 15.15.15.15:15
RP/0/RP0/CPU0:router(config-ext)# end-set

RP/0/RP0/CPU0:router(config)# route-policy my-extcommunity-set-example($tag,$ip)
RP/0/RP0/CPU0:router(config-rpl)# if extcommunity rt matches-any my-extcommunity-set then
RP/0/RP0/CPU0:router(config-rpl-if)# set local-preference 100
RP/0/RP0/CPU0:router(config-rpl-if)# elseif extcommunity rt matches-any (10:20, 10:$tag) 
then
RP/0/RP0/CPU0:router(config-rpl-elseif)# set local-preference 200
RP/0/RP0/CPU0:router(config-rpl-elseif)# elseif extcommunity rt matches-any ($ip:$tag) 
then
RP/0/RP0/CPU0:router(config-rpl-elseif)# set local-preference 300
RP/0/RP0/CPU0:router(config-rpl-elseif)# elseif extcommunity rt matches-any (2.3.4.5:$tag) 
then
RP/0/RP0/CPU0:router(config-rpl-elseif)# set local-preference 400
RP/0/RP0/CPU0:router(config-rpl-elseif)# endif
RP/0/RP0/CPU0:router(config-rpl)# end-policy

Related Commands

Command
Description

extcommunity rt matches-every

Matches every element of a BGP RT extended community set.


extcommunity rt matches-every

To match every element of a Border Gateway Protocol (BGP) route target (RT) extended community set, use the extcommunity rt matches-every command in route-policy configuration mode.

extcommunity rt matches-every {extcommunity-set-name | inline-extcommunity-set}

Syntax Description

extcommunity-set-name

Name of an extended community set.

inline-extcommunity-set

Inline extended community set.


Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 3.3

This command was introduced on the Cisco CRS-1 and Cisco XR 12000 Series Router.

 

This command replaced the extcommunity matches-every command.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the extcommunity rt matches-every command as a conditional expression within an if statement to match every element of an extended community set.


Note For a list of all conditional expressions available within an if statement, see the if command.


A simple condition using the matches-every operator evaluates as true if every extended community value in the extended community attribute for the route matches at least one element of the extended community set or inline set. If no extended community in the route matches any of the specifications in the named or inline set, then this simple condition evaluates to false. Likewise, when there is no extended community at all in the route, the condition evaluates to false.

Matching an extended community in the route to a specification in a named or an inline set is intuitive. Because there is no use of wildcards with extended communities, a community in the route matches a specification in the set if they encode the same 64-bit number. In inline sets, extended community specifications may be parameterized, in which case the relevant matching is done when the value of the parameter has been supplied.

Task ID
Task ID
Operations

route-policy

read, write


Examples

In the following example, an extended community set named my-extcommunity-set and a parameterized route policy named extcommunity-matches-every-example ($as, $tag) are defined. The condition extcommunity rt matches-every is used in an if statement in this policy. If it evaluates to true, the local-preference value is set to 100. If it evaluates to false, the extended community is evaluated using an inline set. If that condition evaluates to true, the local-preference value is set to 200. If it evaluates to false, the local-preference value is set to 300.

RP/0/RP0/CPU0:router(config)# extcommunity-set rt my-extcommunity-set
RP/0/RP0/CPU0:router(config-ext)# 10:20,
RP/0/RP0/CPU0:router(config-ext)# 10:30,
RP/0/RP0/CPU0:router(config-ext)# 10:40
RP/0/RP0/CPU0:router(config-ext)# end-set
RP/0/RP0/CPU0:router(config)# route-policy extcommunity-matches-every-example($as,$tag)
RP/0/RP0/CPU0:router(config-rpl)# if extcommunity rt matches-every my-extcommunity-set 
then
RP/0/RP0/CPU0:router(config-rpl-if)# set local-preference 100
RP/0/RP0/CPU0:router(config-rpl-if)# elseif extcommunity rt matches-every (10:20, 10:$tag, 
$as:30) then
RP/0/RP0/CPU0:router(config-rpl-elseif)# set local-preference 200
RP/0/RP0/CPU0:router(config-rpl-elseif)# elseif
RP/0/RP0/CPU0:router(config-rpl-elseif)# set local-preference 300
RP/0/RP0/CPU0:router(config-rpl-elseif)# endif
RP/0/RP0/CPU0:router(config-rpl)# end-policy

Related Commands

Command
Description

extcommunity rt matches-any

Matches any element of a BGP RT extended community set.


extcommunity-set cost

To define a cost extended community set, use the extcommunity-set cost command in global configuration mode. To remove the cost extended community set, use the no form of this command.

extcommunity-set cost name

no extcommunity-set cost name

Syntax Description

name

Name of a cost extended community set.


Defaults

No default behavior or values

Command Modes

Global configuration

Command History

Release
Modification

Release 3.3

This command was introduced on the Cisco CRS-1 and the Cisco XR 12000 Series Router.

 

This command replaced the extcommunity-set command.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the extcommunity-set cost command to define a cost community type extended community set for Enhanced Interior Gateway Routing Protocol (EIGRP).

An extended community set is analogous to a community set except that it contains extended community values instead of regular community values. Extended community values are 64-bit structured values. An extended community set also supports named forms and inline forms.

As with community sets, the inline form supports parameterization within parameterized policies. Either portion of the extended community value can be parameterized.

Every extended community set must contain at least one extended community value. Empty extended community sets are invalid and the policy configuration system rejects them.


Note Parameterization of the extended community type is not supported. Making wildcards of extended communities is also not currently supported.


Examples

In the following example, a cost extended community set named extcomm-cost is defined:

RP/0/RP0/CPU0:router(config)# extcommunity-set cost extcomm-cost
RP/0/RP0/CPU0:router(config-ext)# IGP:90:914,
RP/0/RP0/CPU0:router(config-ext)# Pre-Bestpath:91:915

RP/0/RP0/CPU0:router(config-ext)# end-set

extcommunity-set rt

To define a route target (RT) extended community set, use the extcommunity-set rt command in global configuration mode. To remove the RT community set, use the no form of this command.

extcommunity-set rt name

no extcommunity-set rt name

Syntax Description

name

Name of an RT extended community set.


Defaults

No default behavior or values

Command Modes

Global configuration

Command History

Release
Modification

Release 3.3

This command was introduced on the Cisco CRS-1 and the Cisco XR 12000 Series Router.

 

This command replaced the extcommunity-set command.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the extcommunity-set rt command to define an RT extended community set for Enhanced Interior Gateway Routing Protocol (EIGRP).

An extcommunity set RT holds RT extended community values to match against the Border Gateway Protocol (BGP) RT extended community attribute. RT extended communities can be entered in either of the following formats:

a.b.c.d:n—IPv4 format. For example, 10.0.0.2:666.

asn:n—BGP ASN format. For example, 10002:666.

Examples

In the following example, an RT extended community set named extcomm-rt is defined:

RP/0/RP0/CPU0:router(config)# extcommunity-set rt extcomm-rt
RP/0/RP0/CPU0:router(config-ext)# 10002:666
RP/0/RP0/CPU0:router(config-ext)# 10.0.0.2:666
RP/0/RP0/CPU0:router(config-ext)# end-set

extcommunity-set soo

To define a Border Gateway Protocol (BGP) Site-of-Origin (SoO) extended community set, use the extcommunity-set soo command in global configuration mode. To remove the SoO extended community set, use the no form of this command.

extcommunity-set soo name

no extcommunity-set soo name

Syntax Description

name

Name of an SoO extended community set.


Defaults

No default behavior or values

Command Modes

Global configuration

Command History

Release
Modification

Release 3.3

This command was introduced on the Cisco CRS-1 and the Cisco XR 12000 Series Router.

 

This command replaced the extcommunity-set command.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the extcommunity-set soo command to define an SoO extended community set for Enhanced Interior Gateway Routing Protocol (EIGRP).

An extcommunity set soo holds SoO extended community values to match against the Border Gateway Protocol (BGP) SoO extended community attribute. SoO extended communities can be entered in either of the following formats:

a.b.c.d:n—IPv4 format. For example, 100.100.100.1:153

asn:n—BGP ASN format. For example, 66:60001

Examples

In the following example, a SoO extended community set named extcomm-soo is defined:

RP/0/RP0/CPU0:router(config)# extcommunity-set soo extcomm-soo
RP/0/RP0/CPU0:router(config-ext)# 66:60001,
RP/0/RP0/CPU0:router(config-ext)# 77:70001,
RP/0/RP0/CPU0:router(config-ext)# 88:80001,
RP/0/RP0/CPU0:router(config-ext)# 99:90001,
RP/0/RP0/CPU0:router(config-ext)# 100.100.100.1:153
RP/0/RP0/CPU0:router(config-ext)# end-set

extcommunity soo is-empty

To determine if a route has any Border Gateway Protocol (BGP) Site-of-Origin (SoO) extended community associated with it, use the extcommunity soo is-empty command in route-policy configuration mode.

extcommunity soo is-empty

Syntax Description

This command has no arguments or keywords.

Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 3.3

This command was introduced on the Cisco CRS-1 and Cisco XR 12000 Series Router.

 

This command replaced the extcommunity is-empty command.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the extcommunity soo is-empty command as a conditional expression within an if statement to learn if a BGP SoO route has extended community attributes associated with it.


Note For a list of all conditional expressions available within an if statement, see the if command.


The is-empty operator takes no arguments and evaluates to true if the route has no extended community attributes associated with it.

Task ID
Task ID
Operations

route-policy

read, write


Examples

In the following example, if the extended community is empty, then the local preference is set to 100:

RP/0/RP0/CPU0:router(config)# route-policy extcommunity-is-empty-example
RP/0/RP0/CPU0:router(config-rpl)# if extcommunity soo is-empty then
RP/0/RP0/CPU0:router(config-rpl-if)# set local-preference 100
RP/0/RP0/CPU0:router(config-rpl-if)# endif

RP/0/RP0/CPU0:router(config-rpl)# end-policy

extcommunity soo matches-any

To match any element of a Border Gateway Protocol (BGP) Site-of-Origin (SoO) extended community set, use the extcommunity soo matches-any command in route-policy configuration mode.

extcommunity soo matches-any {extcommunity-set-name | inline-extcommunity-set}

Syntax Description

extcommunity-set-name

Name of an extended community set.

inline-extcommunity-set

Inline extended community set.


Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 3.3

This command was introduced on the Cisco CRS-1 and Cisco XR 12000 Series Router.

 

This command replaced the extcommunity matches-any command.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the extcommunity soo matches-any command as a conditional expression within an if statement to match elements of an extended community set.


Note For a list of all conditional expressions available within an if statement, see the if command.


A simple condition using the matches-any operator evaluates as true if at least one extended community in the route matches an extended community specification in the named or inline set. If no extended community in the route matches any of the specifications in the named or inline set, then this simple condition evaluates to false. Likewise, when there is no extended community at all in the route, the condition evaluates to false.

Matching an extended community in the route to a specification in a named or an inline set is intuitive. Because there is no use of wildcards with extended communities, a community in the route matches a specification in the set if the community encodes the same 64-bit number. In inline sets, extended community specifications may be parameterized, in which case the relevant matching is done when the value of the parameter has been supplied.

Task ID
Task ID
Operations

route-policy

read, write


Examples

In the following example, an SoO extended community set named extcomm-soo and a parameterized route policy named my-extcommunity-set-example($tag,$ip) are defined.

The condition route policy named extcommunity soo matches-any is used in an if statement in this policy. If it evaluates to true, the local preference value is set to 100.

If it evaluates to false, the SoO extended community is evaluated using an inline set. If it evaluates to true, the local preference value is set to 200.

If it evaluates to false, the the SoO extended community is evaluated using a different inline set. If it evaluates to true, the local preference value is set to 300.

If it evaluates to false, the SoO extended community is evaluated using a different inline set. If it evaluates to true, the local preference value is set to 400.

RP/0/RP0/CPU0:router(config)# extcommunity-set soo extcomm-soo
RP/0/RP0/CPU0:router(config-ext)# 66:60001,
RP/0/RP0/CPU0:router(config-ext)# 77:70001,
RP/0/RP0/CPU0:router(config-ext)# 88:80001,
RP/0/RP0/CPU0:router(config-ext)# 99:90001,
RP/0/RP0/CPU0:router(config-ext)# 100.100.100.1:153
RP/0/RP0/CPU0:router(config-ext)# end-set

RP/0/RP0/CPU0:router(config)# route-policy my-extcommunity-set-example($tag,$ip)
RP/0/RP0/CPU0:router(config-rpl)# if extcommunity soo matches-any extcomm-soo then
RP/0/RP0/CPU0:router(config-rpl-if)# set local-preference 100
RP/0/RP0/CPU0:router(config-rpl-if)# elseif extcommunity soo matches-any (10:20, 10:$tag) 
then
RP/0/RP0/CPU0:router(config-rpl-elseif)# set local-preference 200
RP/0/RP0/CPU0:router(config-rpl-elseif)# elseif extcommunity soo matches-any ($ip:$tag) 
then
RP/0/RP0/CPU0:router(config-rpl-elseif)# set local-preference 300
RP/0/RP0/CPU0:router(config-rpl-elseif)# elseif extcommunity soo matches-any 
(2.3.4.5:$tag) then
RP/0/RP0/CPU0:router(config-rpl-elseif)# set local-preference 400
RP/0/RP0/CPU0:router(config-rpl-elseif)# endif

RP/0/RP0/CPU0:router(config-rpl)# end-policy

Related Commands

Command
Description

extcommunity rt matches-any

Matches any element of a BGP RT extended community set.

extcommunity soo matches-every

Matches every element of a BGP SoO extended community set.


extcommunity soo matches-every

To match every element of a Border Gateway Protocol (BGP) Site-of-Origin (SoO) extended community set, use the extcommunity soo matches-every command in route-policy configuration mode.

extcommunity soo matches-every {extcommunity-set-name | inline-extcommunity-set}

Syntax Description

extcommunity-set-name

Name of an extended community set.

inline-extcommunity-set

Inline extended community set.


Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 3.3

This command was introduced on the Cisco CRS-1 and Cisco XR 12000 Series Router.

 

This command replaced the extcommunity matches-every command.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the extcommunity soo matches-every command as a conditional expression within an if statement to match every element of an extended community set.


Note For a list of all conditional expressions available within an if statement, see the if command.


A simple condition using the matches-every operator evaluates as true if every extended community value in the extended community attribute for the route matches at least one element of the extended community set or inline set. If no extended community in the route matches any of the specifications in the named or inline set, then this simple condition evaluates to false. Likewise, when there is no extended community at all in the route, the condition evaluates to false.

Matching an extended community in the route to a specification in a named or an inline set is intuitive. Because there is no use of wildcards with extended communities, a community in the route matches a specification in the set if they encode the same 64-bit number. In inline sets, extended community specifications may be parameterized, in which case the relevant matching is done when the value of the parameter has been supplied.

Examples

In the following example, an extended community set named my-extcomm-rt-set and a parameterized route policy named extcommunity-matches-every-example($as, $tag) are defined. The condition extcommunity soo matches-every is used in an if statement in this policy and if it evaluates to true, the local-preference value is set to 100. If it evaluates to false, the extended community is evaluated using an inline set. If that condition evaluates to true, the local-preference value is set to 200. If it evaluates to false, the local-preference value is set to 300.

RP/0/RP0/CPU0:router(config)# extcommunity-set soo my-extcomm-rt-set
RP/0/RP0/CPU0:router(config-ext)# 10:20,
RP/0/RP0/CPU0:router(config-ext)# 10:30,
RP/0/RP0/CPU0:router(config-ext)# 10:40
RP/0/RP0/CPU0:router(config-ext)# end-set

RP/0/RP0/CPU0:router(config)# route-policy extcommunity-matches-every-example($as, $tag)
RP/0/RP0/CPU0:router(config-rpl)# if extcommunity soo matches-every my-extcomm-rt-set then
RP/0/RP0/CPU0:router(config-rpl-if)# set local-preference 100
RP/0/RP0/CPU0:router(config-rpl-if)# elseif extcommunity soo matches-every (10:20, 
10:$tag, $as:30) then
RP/0/RP0/CPU0:router(config-rpl-elseif)# set local-preference 200
RP/0/RP0/CPU0:router(config-rpl-elseif)# else
RP/0/RP0/CPU0:router(config-rpl-elseif)# set local-preference 300
RP/0/RP0/CPU0:router(config-rpl-elseif)# endif
RP/0/RP0/CPU0:router(config-rpl)# end-policy

Related Commands

Command
Description

extcommunity soo matches-any

Matches any element of a BGP SoO extended community set.


if

To decide which actions or dispositions should be taken for a given route, use the if command in route-policy configuration mode.

if conditional-expression then action-statement [action-statement] [elseif conditional-expression then action-statement [action-statement]] [else action-statement [action-statement]] endif

Syntax Description

conditional-expression

Expression to decide which actions or dispositions should be taken for the given route.

then

Executes an action statement if the if condition is true.

elseif

Strings together a sequence of tests.

else

Executes an action statement if the if condition is false.

endif

Ends the if statement.

action-statement

Sequence of operations that modify a route.


Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 2.0

This command was introduced on the Cisco CRS-1.

Release 3.0

No modification.

Release 3.2

This command was supported on the Cisco XR 12000 Series Router.

Release 3.3

No modification.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

The if command uses a conditional expression to decide which actions or dispositions should be taken for a given route. Table 1 lists the conditional expressions.

An action statement is a sequence of operations that modify a route, most of which are distinguished by the set keyword. In a route policy, these operations can be grouped. Table 2 lists the action statements.

Table 1 Conditional Expressions 

Command
Description

as-path in

Matches the AS path of a route to an AS path set. The AS path is a sequence of autonomous system numbers traversed by a route.

as-path is-local

Determines if the router (or another router within this autonomous system or confederation) originated the route.

as-path length

Performs a conditional check based on the length of the AS path.

as-path neighbor-is

Tests the autonomous system number or numbers at the head of the AS path against a sequence of one or more integral values or parameters.

as-path originates-from

Compares an AS path to the autonomous system sequence.

as-path passes-through

Tests to learn if the specified integer or parameter appears anywhere in the AS path or if the sequence of integers and parameters appears.

as-path unique-length

Performs specific checks based on the length of the AS path.

community is-empty

Learns if a route has community attributes associated with it.

community matches-any

Matches any element of a community set.

community matches-every

Matches every element of a community set.

destination in

Matches a destination entry in a named prefix set or inline prefix set.

extcommunity rt is-empty

Learns if a route has RT extended community attributes associated with it.

extcommunity rt matches-any

Matches elements of an RT extended community set.

extcommunity rt matches-every

Matches every element of an RT extended community set.

extcommunity soo is-empty

Learns if a route has SoO extended community attributes associated with it.

extcommunity soo matches-any

Matches elements of an SoO extended community set.

extcommunity soo matches-every

Matches every element of an SoO extended community set.

med

Compares the MED to an integer value or a parameterized value.

next-hop in

Compares the next hop associated with the route to data contained in either a named or an inline prefix set.

orf prefix in

Matches a prefix in a prefix set or an inline prefix set.

origin is

Tests the value of the origin attribute.

protocol

Checks if a protocol is installing the route.

rd in

Compares the RD associated with the route to data contained in either a named or an inline RD set.

rib-has-route

Checks if a RIB is in a route.

route-has-label

Checks if a route has a Multiprotocol Label Switching (MPLS) label.

route-type is

Compares route types when redistribution is being performed into BGP, OSPF, or IS-IS.

source in

Tests the source of the route against the data in either a named or an inline prefix set.

tag

Matches a specific tag value.


Table 2 Action Statements 

Command
Description

abort

Discards a route policy definition and returns to global configuration mode.

add

Adds an offset to an existing value.

apply

Executes a parameterized or an unparameterized policy from within another policy.

delete community

Deletes community values from a community list in a route.

delete extcommunity rt

Deletes extended community values from an extended community list in a route.

drop

Drops a route.

end-policy

Ends the definition of a route policy and exits route-policy configuration mode.

exit

Exits a configuration mode.

if

Decides which actions or dispositions should be taken for a given route.

pass

Signifies that even though the route has not been modified, the user wants to continue executing in the policy block.

prepend as-path

Prepends the AS path with additional autonomous system numbers.

set community

Sets the BGP community attribute.

set dampening

Configures BGP route dampening.

set extcommunity cost

Replaces or adds the extended communities for a cost on the route.

set extcommunity rt

Replaces or adds the extended communities for an RT on the route.

set isis-metric

Sets the IS-IS metric attribute value.

set label

Sets the BGP label attribute value.

set level

Configures the IS-IS level in which redistributed routes should be sent.

set local-preference

Specifies a preference value for the autonomous system path.

set med

Sets the MED value.

set metric-type (IS-IS)

Controls whether IS-IS treats the metric as an internal or external metric.

set metric-type (OSPF)

Controls whether OSPF treats the cost as a Type 1 or Type 2 metric.

set next-hop

Replaces the next hop associated with a given route.

set origin

Changes the origin attribute.

set ospf-metric

Sets an OSPF protocol metric attribute value.

set rib-metric

Sets a RIB metric attribute value for a table policy.

set rip-metric

Sets RIP metric attributes.

set rip-tag

Sets route tag attribute.

set tag

Sets the tag attribute.

set traffic-index

Sets the traffic index attribute.

set weight

Sets the weight value for BGP routes.

suppress-route

Indicates that a given component of an aggregate should be suppressed, that is, not advertised.


Task ID
Task ID
Operations

route-policy

read, write


Examples

In the following example, any route whose AS path is in the set as-path-set-1 is dropped:

RP/0/RP0/CPU0:router(config-rpl)# if as-path in as-path-set-1 then 
RP/0/RP0/CPU0:router(config-rpl-if)# drop 
RP/0/RP0/CPU0:router(config-rpl-if)# endif
RP/0/RP0/CPU0:router(config-rpl)#

The contents of the then clause may be an arbitrary sequence of action statements.

The following example shows an if statement with two action statements:

RP/0/RP0/CPU0:router(config-rpl)# if origin is igp then 
RP/0/RP0/CPU0:router(config-rpl-if)# set med 42 
RP/0/RP0/CPU0:router(config-rpl-if)# prepend as-path 73 5 
RP/0/RP0/CPU0:router(config-rpl-if)# endif
RP/0/RP0/CPU0:router(config-rpl)#

The if command also permits an else clause to be executed if the expression is false, as follows:

RP/0/RP0/CPU0:router(config-rpl)# if med eq 200 then
RP/0/RP0/CPU0:router(config-rpl-if)# set community (12:34) additive
RP/0/RP0/CPU0:router(config-rpl-if)# else
RP/0/RP0/CPU0:router(config-rpl-else)# set community (12:56) additive
RP/0/RP0/CPU0:router(config-rpl-else)# endif
RP/0/RP0/CPU0:router(config-rpl)#

The routing policy language (RPL) also provides syntax using the elseif command to string together a sequence of tests, as shown in the following example:

RP/0/RP0/CPU0:router(config-rpl)# if med eq 150 then
RP/0/RP0/CPU0:router(config-rpl-if)# set local-preference 10
RP/0/RP0/CPU0:router(config-rpl-if)# elseif med eq 200 then
RP/0/RP0/CPU0:router(config-rpl-elseif)# set local-preference 60
RP/0/RP0/CPU0:router(config-rpl-elseif)# elseif med eq 250 then
RP/0/RP0/CPU0:router(config-rpl-elseif)# set local-preference 110
RP/0/RP0/CPU0:router(config-rpl-elseif)# else
RP/0/RP0/CPU0:router(config-rpl-else)# set local-preference 0
RP/0/RP0/CPU0:router(config-rpl-else)# endif
RP/0/RP0/CPU0:router(config-rpl)#

The statements within an if statement may themselves be if statements, as shown in this example:

RP/0/RP0/CPU0:router(config-rpl)# if community matches-any (12:34, 56:78) then
RP/0/RP0/CPU0:router(config-rpl-if)# if med eq 150 then
RP/0/RP0/CPU0:router(config-rpl-if)# drop
RP/0/RP0/CPU0:router(config-rpl-if)# endif
RP/0/RP0/CPU0:router(config-rpl-if)# set local-preference 100
RP/0/RP0/CPU0:router(config-rpl-if)# endif
RP/0/RP0/CPU0:router(config-rpl)#

The policy configuration shown sets the value of the local preference attribute to 100 on any route that has a community value of 12:34 or 56:78 associated with it. However, if any of these routes has a Multi Exit Descriminator (MED) value of 150, then each route with both the community value of 12:34 or 56:78 and a MED of 150 is dropped.

med

To compare the Multi Exit Discriminator (MED) to an integer value or a parameterized value, use the med command in route-policy configuration mode.

med {eq | is | ge | le} {number | parameter}

Syntax Description

eq | is | ge | le

Equal to; exact match; greater than or equal to; less than or equal to.

number

Value assigned to a 32-bit unsigned integer. Range is 0 to 4294967295.

parameter

Parameter name. The parameter name must be preceded with a "$."


Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 2.0

This command was introduced on the Cisco CRS-1.

Release 3.0

No modification.

Release 3.2

This command was supported on the Cisco XR 12000 Series Router.

Release 3.3

No modification.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the med command as a conditional expression within an if statement to compare the MED to an integer value or a parameterized value.


Note For a list of all conditional expressions available within an if statement, see the if command.


The MED is a 32-bit unsigned integer. The eq operation compares the MED to either a static value or a parameterized value passed to a parameterized policy for equality with that value. A greater than or equal to comparison can also be done with the ge operator, and a less than or equal to comparison can be performed using the le operator.

Task ID
Task ID
Operations

route-policy

read, write


Examples

The following example shows that if the med commands match, the local preference is set to 100:

RP/0/RP0/CPU0:router(config-rpl)# if med eq 10 then 
RP/0/RP0/CPU0:router(config-rpl-if)# set local-preference 100
RP/0/RP0/CPU0:router(config-rpl-if)# endif
RP/0/RP0/CPU0:router(config-rpl)#

next-hop in

To compare the next hop associated with the route to data contained in either an inline or a named prefix set, use the next-hop in command in route-policy configuration mode.

next-hop in {prefix-set-name | inline-prefix-set}

Syntax Description

prefix-set-name

Name of a prefix set.

inline-prefix-set

Inline prefix set.


Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 2.0

This command was introduced on the Cisco CRS-1.

Release 3.0

No modification.

Release 3.2

This command was supported on the Cisco XR 12000 Series Router.

Release 3.3

No modification.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the next-hop in command as a conditional expression within an if statement to compare the next hop associated with the route to data contained in either an inline or a named prefix set. The result is true if any value in the prefix set matches the next hop of the route. A comparison that refers to a named prefix set that has no elements in it returns false.


Note For a list of all conditional expressions available within an if statement, see the if command.


The next hop is an IPv4 address entered as a dotted-decimal or an IPv6 address entered as a colon-separated hexadecimal.

Task ID
Task ID
Operations

route-policy

read, write


Examples

The following example shows that if the next-hop in commands match, the local preference is set to 100

RP/0/RP0/CPU0:router(config-rpl)# if next-hop in some-prefix-set then 
RP/0/RP0/CPU0:router(config-rpl-if)# if next-hop in (10.0.0.5, fe80::230/64) then 
RP/0/RP0/CPU0:router(config-rpl-if)# set local-preference 0
RP/0/RP0/CPU0:router(config-rpl-if)# endif
RP/0/RP0/CPU0:router(config-rpl)#

orf prefix in

To configure an outbound route filter (ORF), use the orf prefix in command in route-policy configuration mode.

orf prefix in {prefix-set-name | inline-prefix-set}

Syntax Description

prefix-set-name

Name of a prefix set.

inline-prefix-set

Inline prefix set.


Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 3.3

This command was introduced on the Cisco CRS-1 and Cisco XR 12000 Series Router.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use this command to match a prefix in a prefix set or an inline prefix set.

Examples

In the following example, the prefix set orfpreset1 and the route policy named orfpolicy are defined. Next, the orfpolicy is applied to the neighbor orf attach point.

If the prefix of the route matches any of the prefixes specified in orfpreset1 (211.105.1.0/24, 211.105.5.0/24, 211.105.11.0/24), then the prefix is dropped. If the prefix matches in(211.105.3.0/24, 211.105.7.0/24, 211.105.13.0/24), then the prefix is accepted. In addition to this inbound filtering, BGP sends these prefix entries to the upstream neighbor indicating a permit or deny so that the neighbor can make the same filter updates.

RP/0/RP0/CPU0:router(config)# prefix-set orfpreset1
RP/0/RP0/CPU0:router(config-pfx)# 211.105.1.0/24,
RP/0/RP0/CPU0:router(config-pfx)# 211.105.5.0/24,
RP/0/RP0/CPU0:router(config-pfx)# 211.105.11.0/24
RP/0/RP0/CPU0:router(config-pfx)# end-set
!
!
RP/0/RP0/CPU0:router(config)# route-policy orfpolicy
RP/0/RP0/CPU0:router(config-rpl)# if orf prefix in orfpreset1 then
RP/0/RP0/CPU0:router(config-rpl-if)# drop
RP/0/RP0/CPU0:router(config-rpl-if)# endif
RP/0/RP0/CPU0:router(config-rpl)# if orf prefix in (211.105.3.0/24, 211.105.7.0/24, 
211.105.13.0/24) then
RP/0/RP0/CPU0:router(config-rpl-if)# pass
RP/0/RP0/CPU0:router(config-rpl-if)# endif
RP/0/RP0/CPU0:router(config-rpl)# end-policy
!
!
RP/0/RP0/CPU0:router(config)# router bgp 2
RP/0/RP0/CPU0:router(config-bgp)# neighbor 1.1.1.1
RP/0/RP0/CPU0:router(config-bgp-nbr)# remote-as 3
RP/0/RP0/CPU0:router(config-bgp-nbr)# address-family ipv4 unicast
RP/0/RP0/CPU0:router(config-bgp-nbr-af)# orf route-policy orfpolicy

origin is

To match a specific origin type, use the origin is command in route-policy configuration mode.

origin is {igp | egp | incomplete | parameter}

Syntax Description

igp

Specifies Interior Gateway Protocol.

egp

Specifies Exterior Gateway Protocol.

incomplete

Specifies that Border Gateway Protocol (BGP) first learned the route by means other than BGP or Interior Gateway Protocol (IGP); for example, the route is learned through configuration.

parameter

Parameter name. The parameter name must be preceded with a "$."


Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 2.0

This command was introduced on the Cisco CRS-1.

Release 3.0

No modification.

Release 3.2

This command was supported on the Cisco XR 12000 Series Router.

Release 3.3

No modification.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the origin is command as a conditional expression within an if statement to test the value of the origin attribute.


Note For a list of all conditional expressions available within an if statement, see the if command.


The origin of a BGP route is an enumeration; it is igp, egp, or incomplete.

This command can be parameterized.

Task ID
Task ID
Operations

route-policy

read, write


Examples

In the following example, the origin is tested within an if statement to learn if it is either igp or egp:

RP/0/RP0/CPU0:router(config-rpl)# if origin is igp or origin is egp then 

In the following example, a parameter is used to match a specific origin type:

RP/0/RP0/CPU0:router(config)# route-policy bar($origin)
RP/0/RP0/CPU0:router(config-rpl)# if origin is $origin then
RP/0/RP0/CPU0:router(config-rpl-if)# set med 20
RP/0/RP0/CPU0:router(config-rpl-if)# endif
RP/0/RP0/CPU0:router(config-rpl)# 

pass

To pass a route for further processing, use the pass command in route-policy configuration mode.

pass

Syntax Description

This command has no arguments or keywords.

Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 2.0

This command was introduced on the Cisco CRS-1.

Release 3.0

No modification.

Release 3.2

This command was supported on the Cisco XR 12000 Series Router.

Release 3.3

No modification.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the pass command to signify that even though this route has not been modified, the user wants to continue executing in this policy block.


Note The pass command can be used as an action statement within an if statement. For a list of all action statements available within an if statement, see the if command.


When a policy block has finished executing, any route that has been modified in this policy block or has received a pass disposition in this policy block passes the policy and execution finishes for that policy. If this policy block is applied from within another policy block and the route is either passed or modified, then execution continues in the policy block that applied this policy block.

Task ID
Task ID
Operations

route-policy

read, write


Examples

The following example shows how to accept the route unconditionally without modifying it:

RP/0/RP0/CPU0:router(config-rpl)# pass

This example accepts the route unconditionally, without modifying it, if the destination is in prefix-set permitted:

RP/0/RP0/CPU0:router(config-rpl)# if destination in permitted then
RP/0/RP0/CPU0:router(config-rpl-if)# pass
RP/0/RP0/CPU0:router(config-rpl-if)# endif
RP/0/RP0/CPU0:router(config-rpl)#

prefix-set

To enter prefix set configuration mode and define a prefix set, use the prefix-set command in global configuration mode. To remove a named prefix set, use the no form of this command.

prefix-set name

no prefix-set name

Syntax Description

name

Name of a prefix set.


Defaults

No default behavior or values

Command Modes

Global configuration

Command History

Release
Modification

Release 2.0

This command was introduced on the Cisco CRS-1.

Release 3.0

No modification.

Release 3.2

This command was supported on the Cisco XR 12000 Series Router.

Release 3.3

No modification.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the prefix-set command to enter prefix set configuration mode and define a prefix set.

A prefix set is a comma-separated list of prefix match specifications. It holds IPv4 or IPv6 prefix match specifications, each of which has four parts: an address, a mask length, a minimum matching length, and a maximum matching length. The address is required, but the other three parts are optional. The address is a standard four-part, dotted-decimal numeric IPv4 address or a colon-separated hexadecimal IPv6 address. The mask length, if present, is a nonnegative decimal integer in the range from 0 to 32 for IPv4 prefixes or 0 to 128 for IPv6 prefixes following the address and separated from it by a slash. The optional minimum matching length follows the address and optional mask length and is expressed as the keyword ge (mnemonic for greater than or equal to), followed by a nonnegative decimal integer in the range from 0 to 32 for IPv4 or 0 to 128 for IPv6. The optional maximum matching length follows the rest and is expressed by the keyword le (mnemonic for less than or equal to), followed by yet another nonnegative decimal integer in the range from 0 to 32 for IPv4 or 0 to 128 for IPv6. A syntactic shortcut for specifying an exact length for prefixes to match is the eq keyword, mnemonic for equal to.

If a prefix match specification has no mask length, then the default mask length is 32 for IPv4 or 128 for IPv6. The default minimum matching length is the mask length. If a minimum matching length is specified, then the default maximum matching length must be less than 32 for IPv4 prefixes or 128 for IPv6 prefixes. Otherwise, if neither a minimum nor maximum length is specified, the default maximum length is the mask length.

Task ID
Task ID
Operations

route-policy

read, write


Examples

The following example shows a prefix set named legal-ipv4-prefix-examples:

RP/0/RP0/CPU0:router(config)# prefix-set legal-ipv4-prefix-examples
RP/0/RP0/CPU0:router(config-pfx)# 10.0.1.1,
RP/0/RP0/CPU0:router(config-pfx)# 10.0.2.0/24,
RP/0/RP0/CPU0:router(config-pfx)# 10.0.3.0/24 ge 28,
RP/0/RP0/CPU0:router(config-pfx)# 10.0.4.0/24 le 28,
RP/0/RP0/CPU0:router(config-pfx)# 10.0.5.0/24 ge 26 le 30,
RP/0/RP0/CPU0:router(config-pfx)# 10.0.6.0/24 eq 28
RP/0/RP0/CPU0:router(config-pfx)# end-set

The first element of the prefix set matches only one possible value, 10.0.1.1/32 or the host address 10.0.1.1. The second element matches only one possible value, 10.0.2.0/24. The third element matches a range of prefix values, from 10.0.3.0/28 to 10.0.3.255/32. The fourth element matches a range of values, from 10.0.4.0/24 to 10.0.4.240/28. The fifth element matches prefixes in the range from 10.0.5.0/26 to 10.0.5.252/30. The sixth element matches any prefix of length 28 in the range from 10.0.6.0/28 through 10.0.6.240/28.

The following prefix set consists entirely of invalid prefix match specifications:

RP/0/RP0/CPU0:router(config)# prefix-set INVALID-PREFIX-EXAMPLES
RP/0/RP0/CPU0:router(config-pfx)# 10.1.1.1 ge 16,
RP/0/RP0/CPU0:router(config-pfx)# 10.1.2.1 le 16,
RP/0/RP0/CPU0:router(config-pfx)# 10.1.3.0/24 le 23,
RP/0/RP0/CPU0:router(config-pfx)# 10.1.4.0/24 ge 33,
RP/0/RP0/CPU0:router(config-pfx)# 10.1.5.0/25 ge 29 le 28
RP/0/RP0/CPU0:router(config-pfx)# end-set

Neither the minimum length nor the maximum length is legal without a mask length. The maximum length must be at least the mask length. The minimum length must be less than 32, the maximum length of an IPv4 prefix. The maximum length must be equal to or greater than the minimum length.

The following example shows a valid IPv6 prefix set named legal-ipv6-prefix-examples:

RP/0/RP0/CPU0:router(config)# prefix-set legal-ipv6-prefix-examples
RP/0/RP0/CPU0:router(config-pfx)# 2001:0:0:1::/64,
RP/0/RP0/CPU0:router(config-pfx)# 2001:0:0:2::/64,
RP/0/RP0/CPU0:router(config-pfx)# 2001:0:0:3::/64,
RP/0/RP0/CPU0:router(config-pfx)# 2001:0:0:4::/64
RP/0/RP0/CPU0:router(config-pfx)# end-set

prepend as-path

To prepend the AS path with additional autonomous system numbers, use the prepend as-path command in route-policy configuration mode.

prepend as-path {as-number | parameter} [number | parameter]

Syntax Description

as-number

Autonomous system number to prepend to the path.

parameter

Parameter name. The parameter name must be preceded with a "$."

number

(Optional) Number of times the autonomous system number should be prepended.


Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 2.0

This command was introduced on the Cisco CRS-1.

Release 3.0

No modification.

Release 3.2

This command was supported on the Cisco XR 12000 Series Router.

Release 3.3

No modification.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the prepend as-path command to prepend the AS path with additional autonomous system numbers.


Note The prepend as-path command can be used as an action statement within an if statement. For a list of all action statements available within an if statement, see the if command.


This command can take one or two arguments. The first argument (either a number or parameter) is the autonomous system number to prepend to the path. The optional second argument (either a number or parameter) is the number of times the autonomous system number should be prepended.

Task ID
Task ID
Operations

route-policy

read, write


Examples

The following example shows how to prepend the autonomous system number 666 to the AS path three times:

RP/0/RP0/CPU0:router(config-rpl)# prepend as-path 666 3


The following example shows how to prepend the autonomous system number 666 to the AS path one time:

RP/0/RP0/CPU0:router(config-rpl)# prepend as-path 666 

protocol

To check the protocol that installs the route, use the protocol command in route-policy configuration mode.

protocol {in ( protocol-set ) | is protocol-name}

Syntax Description

in (protocol-set)

Specifies a member of a set. The protocol-set argument accepts the following keywords within parenthesis:

bgp—Border Gateway Protocol (BGP)

connected—Connected routes

eigrp—Enhanced Interior Gateway Routing Protocol (EIGRP)

isis—ISO IS-IS

ospf—Open Shortest Path First (OSPF)

rip—Routing Information Protocol (RIP)

static—Static routes

Note Keywords must be separated by a comma.

is protocol-name

Specifies a single protocol name, and accepted keywords are similar to the protocol-set argument.


Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 3.3

This command was introduced on the Cisco CRS-1 and Cisco XR 12000 Series Router.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the protocol command as a conditional expression within an if statement to specify a protocol to install a route.


Note For a list of all conditional expressions available within an if statement, see the if command.


Task ID
Task ID
Operations

route-policy

read, write


Examples

The following example shows how to use the protocol command as a conditional expression within if statements:

RP/0/RP0/CPU0:router(config)# route-policy rip1
RP/0/RP0/CPU0:router(config-rpl)# if protocol in (connected, static) then 
RP/0/RP0/CPU0:router(config-rpl-if)# add rip-metric 2
RP/0/RP0/CPU0:router(config-rpl-if)# elseif protocol is bgp 1 then
RP/0/RP0/CPU0:router(config-rpl-elseif)# add rip-metric 3
RP/0/RP0/CPU0:router(config-rpl-elseif)# elseif protocol is ospf 2 then
RP/0/RP0/CPU0:router(config-rpl-elseif)# add rip-metric 4
RP/0/RP0/CPU0:router(config-rpl-elseif)# else
RP/0/RP0/CPU0:router(config-rpl-else)# add rip-metric 5
RP/0/RP0/CPU0:router(config-rpl-else)# endif
RP/0/RP0/CPU0:router(config-rpl)# end-policy

RP/0/RP0/CPU0:router(config)# router rip
RP/0/RP0/CPU0:router(config-rip)# interface GigabitEthernet0/1/0/1
RP/0/RP0/CPU0:router(config-rip-if)# route-policy rip1 out

rd in

To compare the route distinguisher (RD) associated with the route to RDs contained in either a named or an inline RD set, use the rd in command in route-policy configuration mode.

rd in {rd-set-name | inline-rd-set}

Syntax Description

rd-set-name

Name of an RD set.

inline-rd-set

Inline RD set.


Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 3.3

This command was introduced on the Cisco CRS-1 and Cisco XR 12000 Series Router.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the rd in command as a conditional expression within an if statement to match a destination entry in a named prefix set or inline prefix set.


Note For a list of all conditional expressions available within an if statement, see the if command.


This command takes either a named RD set or an inline RD set value as an argument. The condition returns true if the destination entry matches any entry in the RD set or inline RD set. An attempt to match an RD using an RD set that is defined but contains no elements returns false.

Task ID
Task ID
Operations

route-policy

read, write


Examples

The following example shows the rd in command with an inline RD set value as an argument:

RP/0/RP0/CPU0:router(config)# route-policy
RP/0/RP0/CPU0:router(config-rpl)# if rd in (128.1.0.0/16:100) then
RP/0/RP0/CPU0:router(config-rpl-if)# pass
RP/0/RP0/CPU0:router(config-rpl-if)# endif
RP/0/RP0/CPU0:router(config-rpl)# end-policy

rd-set

To define a route distinguisher (RD) set and enter RD configuration mode, use the rd-set command in global configuration mode.

rd-set name

no rd-set name

Syntax Description

name

Name of an RD community set.


Defaults

No default behavior or values

Command Modes

Global configuration

Command History

Release
Modification

Release 3.3

This command was introduced on the Cisco CRS-1 and Cisco XR 12000 Series Router.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the rd-set command to create a set with RD elements and enter RD configuration mode. An RD set is a 64-bit value prepended to an IPv4 address to create a globally unique Border Gateway Protocol (BGP) VPN IPv4 address.

You can define RD values with the following commands:

a.b.c.d:m:*—BGP VPN RD in IPv4 format with a wildcard character. For example, 10.0.0.2:255.255.0.0:*.

a.b.c.d/m:n—BGP VPN RD in IPv4 format with a mask. For example, 10.0.0.2:255.255.0.0:666.

a.b.c.d:* —BGP VPN RD in IPv4 format with a wildcard character. For example, 10.0.0.2:255.255.0.0.

a.b.c.d:n— BGP VPN RD in IPv4 format. For example, 10.0.0.2:666.

asn:*— BGP VPN RD in ASN format with a wildcard character. For example, 10002:255.255.0.0.

asn:n—BGP VPN RD in ASN format. For example, 10002:666.

Task ID
Task ID
Operations

route-policy

read, write


Examples

The following example shows how to create an RD set called my_rd_set:

RP/0/RP0/CPU0:router(config)# rd-set my_rd_set
RP/0/RP0/CPU0:router(config-rd)# 172.16.0.0/16:*,
RP/0/RP0/CPU0:router(config-rd)# 172.17.0.0/16:100,
RP/0/RP0/CPU0:router(config-rd)# 192:*,
RP/0/RP0/CPU0:router(config-rd)# 192:100
RP/0/RP0/CPU0:router(config-rd)# end-set

rib-has-route

To check if there is a Routing Information Base (RIB) in a route, use the rib-has-route command in route-policy configuration mode.

rib-has-route in name

Syntax Description

name

Name for a prefix set.


Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 2.0

This command was introduced on the Cisco CRS-1.

Release 3.0

No modification.

Release 3.2

This command was supported on the Cisco XR 12000 Series Router.


Release 3.3

No modification.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

If routes are active, then they are advertised. Routes are considered active if they are already installed in the Routing Information Base (RIB) by the Border Gateway Protocol (BGP).

Use the rib-has-route command as a conditional expression within an if statement to check if there is an active route with a specific prefix set contained in the RIB. If the statement reveals an active route that meets that criteria, additional actions are executed.

For a list of all conditional expressions available within an if statement, see the if command.

Task ID
Task ID
Operations

route-policy

read, write


Examples

In the following example, an if statement is used to learn if a route with a prefix set named pf1 is in the RIB:

RP/0/RP0/CPU0:router(config-rpl)# if rib-has-route in pf1 then
RP/0/RP0/CPU0:router(config-rpl-if)# pass
RP/0/RP0/CPU0:router(config-rpl-if)# endif
RP/0/RP0/CPU0:router(config-rpl)#

route-has-label

To check if there is an MPLS label in a route during redistribution, use the route-has-label command in route-policy configuration mode.

route-has-label

Syntax Description

This command has no arguments or keywords.

Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 3.3

This command was introduced on the Cisco CRS-1 and Cisco XR 12000 Series Router.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the route-has-label command as a conditional expression within an if statement to check if there is a RIB in a route.

For a list of all conditional expressions available within an if statement, see the if command.

Task ID
Task ID
Operations

route-policy

read, write


Examples

In the following example, an if statement learns if an MPLS label is present in a route:

RP/0/RP0/CPU0:router(config-rpl)# if route-has-label then
RP/0/RP0/CPU0:router(config-rpl-if)# pass
RP/0/RP0/CPU0:router(config-rpl-if)# endif
RP/0/RP0/CPU0:router(config-rpl)#

route-policy (RPL)

To define a route policy and enter route-policy configuration mode, use the route-policy command in global configuration mode. To remove a policy definition, use the no form of this command.

route-policy name [parameter1, parameter2, . . . , parameterN]

no route-policy name [parameter1, parameter2, . . . , parameterN]

Syntax Description

name

Name of a route policy.

parameter

(Optional) Parameter name. The parameter name must be preceded with a "$."


Defaults

No default behavior or values

Command Modes

Global configuration

Command History

Release
Modification

Release 2.0

This command was introduced on the Cisco CRS-1.

Release 3.0

No modification.

Release 3.2

This command was supported on the Cisco XR 12000 Series Router.

Release 3.3

No modification.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the route-policy command to define a route policy and enter route-policy configuration mode.

Policy definitions create named bundles of policy statements. A policy definition consists of the route-policy command followed by a name, a group of policy statements, and the end-policy command.

The policy name serves as a handle for binding the policy to protocols.

Task ID
Task ID
Operations

route-policy

read, write


Examples

The following example shows a simple policy named drop-everything that drops any route it encounters:

RP/0/RP0/CPU0:router(config)# route-policy drop-everything
RP/0/RP0/CPU0:router(config-rpl)# drop
RP/0/RP0/CPU0:router(config-rpl)# end-policy

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 command. The following is a simple example:

RP/0/RP0/CPU0:router(config)# route-policy drop-as-1234
RP/0/RP0/CPU0:router(config-rpl)# if as-path passes-through '1234' then
RP/0/RP0/CPU0:router(config-rpl-if)# apply check-communities
RP/0/RP0/CPU0:router(config-rpl-if)# else
RP/0/RP0/CPU0:router(config-rpl-else)# pass
RP/0/RP0/CPU0:router(config-rpl-else)# endif
RP/0/RP0/CPU0:router(config-rpl)# end-policy

The apply command indicates that the policy check-communities should be executed if the route under consideration passed through autonomous system 1234 before it was received. If so, the communities of the route are checked, and based on the findings the route may be accepted unmodified, accepted with changes, or dropped.

Related Commands

Command
Description

end-policy

Ends the definition of a route policy.


route-type is

To match route types when redistribution is being performed into Border Gateway Protocol (BGP), Open Shortest Path First (OSPF), or Integrated Intermediate System-to-Intermediate System (IS-IS), use the route-type is command in route-policy configuration mode.

route-type is {local | interarea | internal | type-1 | type-2 | level-l | level-2 | level-1-2 | parameter}

Syntax Description

local

Uses a local value to match locally generated OSPF routes.

interarea

Uses an interarea value to match IS-IS interarea routes.

internal

Uses an internal value to match OSPF intra- and interarea routes.

type-1

Uses a Type 1 value to match Type 1 OSPF routes.

type-2

Uses a Type 2 value to match Type 2 OSPF routes.

level-1

Uses a Level 1 value to match Level 1 IS-IS routes.

level-2

Uses a Level 2 value to match Level 2 IS-IS routes.

level-1-2

Uses an interarea value to match IS-IS interarea routes.

parameter

Parameter name. The parameter name must be preceded with a "$."


Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 2.0

This command was introduced on the Cisco CRS-1.

Release 3.0

No modification.

Release 3.2

This command was supported on the Cisco XR 12000 Series Router.

 

The level-1-2 keyword was replaced with the interarea keyword.

Release 3.3

No modification.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the route-type is command as a conditional expression within an if statement to compare route types when redistribution is being performed into BGP, OSPF, or IS-IS.


Note For a list of all conditional expressions available within an if statement, see the if command.


The valid keywords are local, internal, type-1, type-2, level-1, level-2, and level-1-2. A parameterized value that fills in one of these values may also be used. The local value is used to match locally generated BGP routes. The internal value is used to match OSPF intra- and interarea routes. The type-1 and type-2 values are used to match Type 1 and Type 2 OSPF external routes. The level-1, level-2, and level-1-2 values are used to match IS-IS routes of those respective types.

Because the route type is a matching operator, it appears in conditional clauses of if and then statements.

Task ID
Task ID
Operations

route-policy

read, write


Examples

In the following example, non-local routes are dropped:

RP/0/RP0/CPU0:router(config)# route-policy policy_A
RP/0/RP0/CPU0:router(config-rpl)# if route-type is local then 
RP/0/RP0/CPU0:router(config-rpl-if)# pass
RP/0/RP0/CPU0:router(config-rpl-if)# else
RP/0/RP0/CPU0:router(config-rpl-else)# drop
RP/0/RP0/CPU0:router(config-rpl-if)# endif
RP/0/RP0/CPU0:router(config-rpl)# end-policy

rpl editor

To set the default routing policy language (RPL) editor, use the rpl editor command in in global configuration mode.

rpl editor {emacs | vim}

Syntax Description

emacs

Sets the default RPL editor to EMACS.

vim

Sets the default RPL editor to VIM.


Defaults

Emacs editor

Command Modes

Global configuration

Command History

Release
Modification

Release 3.3.0

This command was introduced on the Cisco CRS-1 and Cisco XR 12000 Series Router.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Task ID
Task ID
Operations

route-policy

read, write


Examples

In the following example, the default RPL editor is set to EMACS:

RP/0/RP0/CPU0:router# configure
RP/0/RP0/CPU0:router(config)# rpl emacs
RP/0/RP0/CPU0:router(config)# 

In the following example, the default RPL editor is set to VIM:

RP/0/RP0/CPU0:router# configure
RP/0/RP0/CPU0:router(config)# rpl vim
RP/0/RP0/CPU0:router(config)# 

rpl maximum

To configure system limits on the routing policy subsystem, use the rpl maximum command in global configuration mode.

rpl maximum {{lines | policies} number}

Syntax Description

lines number

Configures the number of lines of configuration limit. Range is from 1 to 131072.

policies number

Configures the number of policies limit. Range is from 1 to 5000.


Defaults

lines number: 65536
policies numbers: 3500

Command Modes

Global configuration

Command History

Release
Modification

Release 2.0

This command was introduced on the Cisco CRS-1.

Release 3.0

No modification.

Release 3.2

This command was supported on the Cisco XR 12000 Series Router.

Release 3.3

No modification.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the rpl maximum command to configure system limits on the routing policy subsystem. As such, rpl maximum configuration lines do not appear as statements within a routing policy. This command places resource limits on the routing policy subsystem. Use the rpl maximum command to configure the maximum number of lines of configuration and number of policies.

The number of lines of configuration includes the beginning and ending statements, for example, route-policy and end-policy. Each line of configuration for sets is also counted.

A line of configuration is counted only once; it is not counted each time it is used. Similarly, any multiple use of policy in an apply statement counts only as one policy.

A user can change the default values for lines and policies but cannot exceed the maximum value, nor can the value for lines and policies be configured lower than the number of lines or policies that are currently configured.

Task ID
Task ID
Operations

route-policy

read, write


Examples

In the following example, the maximum number of RPL system limits are modified:

RP/0/RP0/CPU0:router# configure
RP/0/RP0/CPU0:router(config)# rpl maximum lines 50
RP/0/RP0/CPU0:router(config)# rpl maximum policies 6
RP/0/RP0/CPU0:router(config)# rpl maximum elseifs 12
RP/0/RP0/CPU0:router(config)# rpl maximum ifconditions 12
RP/0/RP0/CPU0:router(config)# rpl maximum ifdepth 30

Related Commands

Command
Description

show rpl maximum

Displays the maximum limits for lines of configuration and number of policies.


set community

To set the Border Gateway Protocol (BGP) community attributes in a route, use the set community command in route-policy configuration mode.

set community {community-set-name | inline-community-set} [additive]

Syntax Description

community-set-name

Community set name.

inline-community-set

Inline community set.

additive

(Optional) Adds communities to communities in the route.


Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 2.0

This command was introduced on the Cisco CRS-1.

Release 3.0

No modification.

Release 3.2

This command was supported on the Cisco XR 12000 Series Router.

Release 3.3

No modification.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the set community command to set the BGP community attribute.


Note The set community command can be used as an action statement within an if statement. For a list of all action statements available within an if statement, see the if command.


Communities are 32-bit values carried in BGP routes. Each route may have zero or more communities in an unordered list.

Use this command to replace the communities in a route or add to them using the optional additive keyword.

As with the other community forms that support inline sets, either or both 16-bit portions of the community can be parameterized. Likewise, the names of the well-known communities internet, no-advertise, no-export, and local-AS can also be used.

Without the additive keyword, any existing communities (other than the well-known communities) are removed and replaced with the given communities. The additive keyword specifies that all communities already present in the route be maintained and the list of communities be added to them.

Task ID
Task ID
Operations

route-policy

read, write


Examples

The following are incomplete configuration examples using the set community command:

RP/0/RP0/CPU0:router(config-rpl)# set community (10:24)
RP/0/RP0/CPU0:router(config-rpl)# set community (10:24, $as:24, $as:$tag)
RP/0/RP0/CPU0:router(config-rpl)# set community (10:24, internet) additive
RP/0/RP0/CPU0:router(config-rpl)# set community (10:24, $as:24) additive

set cost

To set the cost attribute for a BGP extended community, use the set cost command in route-policy configuration mode.

set cost {number | parameter}

Syntax Description

number

Value assigned to a 32-bit unsigned integer. Range is from 0 to 4294967295.

parameter

Parameter name. The parameter name must be preceded with a "$."


Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 2.0

This command was introduced on the Cisco CRS-1.

Release 3.0

No modification.

Release 3.2

This command was supported on the Cisco XR 12000 Series Router.

Release 3.3

In previous software releases, this command set the Open Shortest Path First (OSPF), cost attribute. Use the set ospf-metric command to set the OSPF cost attribute.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Task ID
Task ID
Operations

route-policy

read, write


Examples

In the following example, the cost attribute for BGP extended community is set to 10:

RP/0/RP0/CPU0:router(config-rpl)# set cost 10

set dampening

To configure Border Gateway Protocol (BGP) route dampening, use the set dampening command in route-policy configuration mode.

set dampening {halflife minutes | max-suppress minutes | reuse seconds | suppress penalty-units} others default

Syntax Description

halflife minutes

Specifies the time (in minutes) after which a penalty is decreased. After the route has been assigned a penalty, the penalty is decreased by half after the half-life period. The process of reducing the penalty happens every 5 seconds. Range is 1 to 45 minutes.

max-suppress minutes

Specifies the maximum time (in minutes) a route can be suppressed. Range is 1 to 20000. If the half-life value is allowed to default, the maximum suppress time defaults to 60 minutes.

reuse seconds

Unsuppresses a route if the penalty for flapping the route decreases enough to fall below the configured value (in seconds). The process of unsuppressing routes occurs at 10-second increments. Range is 1 to 20000.

suppress penalty-units

Specifies a penalty of 1000 each time a route flaps. When a route penalty exceeds the configured limit, it is suppressed. Range is 1 to 20000.

others default

If all four keyword values are not specified in the command, then the command must end with others default. This designation indicates that any keyword not defined is set to its default.


Defaults

half-life: 15 minutes
max-suppress: 60 minutes (four times the half-life)
reuse: 750 seconds
suppress: 2000 penalty units

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 2.0

This command was introduced on the Cisco CRS-1.

Release 3.0

No modification.

Release 3.2

This command was supported on the Cisco XR 12000 Series Router.

Release 3.3

No modification.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

The BGP protocol supports route dampening using an exponential backoff algorithm. The algorithm is controlled by setting the four supported BGP values: half-life, max-suppress, reuse, and suppress. Use the set dampening command to configure BGP route dampening.


Note The set dampening command can be used as an action statement within an if statement . For a list of all action statements available within an if statement, see the if command.


A value for at least one of the four keywords must be set. If the set dampening command defines values for three or fewer of the supported keywords, then the configuration must end with the others default, which indicates that any keyword value not defined in the command is set to its default value.

The keywords may appear in the command in any order.

Task ID
Task ID
Operations

route-policy

read, write


Examples

In the following examples, the half-life is set to 20 minutes and the maximum suppress time is set to
90 minutes. Each command must end with others default because three or fewer keywords are defined.

RP/0/RP0/CPU0:router(config-rpl)# set dampening halflife 20 others default
RP/0/RP0/CPU0:router(config-rpl)# set dampening max-suppress 90 others default

In this example, all four keywords are defined, which means the command does not use others default.

RP/0/RP0/CPU0:router(config-rpl)# set dampening halflife 15 max-suppress 60 reuse 750 
suppress 2000

The following command is invalid because it is missing others default.

RP/0/RP0/CPU0:router(config-rpl)# set dampening reuse 700

set eigrp-metric

To set Enhanced Interior Gateway Routing Protocol (EIGRP) metric attributes, use the set eigrp-metric command in route-policy configuration mode.

set eigrp-metric bandwidth delay reliability loading mtu

Syntax Description

bandwidth

Minimum bandwidth of the route in kilobits per second. Range is 1 to 4294967295.

delay

Route delay in tens of microseconds. Delay is 1 or any positive number that is a multiple of 39.1 nanoseconds. Range is 1 to 4294967295.

reliability

Likelihood of successful packet transmission expressed as a number between 0 and 255. The value 255 means 100 percent reliability; 0 means no reliability.

loading

Effective bandwidth of the route expressed as a number from 1 to 255 (255 is 100 percent loading).

mtu

Minimum maximum transmission unit (MTU) size of the route in bytes. Range is from 1 to 65535.


Defaults

None

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 3.3

This command was introduced on the Cisco CRS-1 and Cisco XR 12000 Series Router.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

You can use the add command to further offset an existing EIGRP metric value.

Task ID
Task ID
Operations

route-policy

read, write


Examples

In the following example, the EIGRP metrics are adjusted for route policy policy_1:

RP/0/RP0/CPU0:router(config)# route-policy policy_1
RP/0/RP0/CPU0:router(config-rpl)# set eigrp-metric 1400 120 250 100 1500
RP/0/RP0/CPU0:router(config-rpl)# end-policy

Related Commands

Command
Description

add

Adds an offset to an existing value.


set extcommunity cost

To set the Border Gateway Protocol (BGP) extended community attribute for cost, use the set extcommunity cost command in route-policy configuration mode.

set extcommunity cost {cost-extcommunity-set-name | cost-inline-extcommunity-set} [additive]

Syntax Description

cost-extcommunity-set-name

Cost extended community set name.

cost-inline-extcommunity-set

Inline cost extended community set.

additive

(Optional) Adds extended communities for cost to extended communities in the route.


Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 3.3

This command was introduced on the Cisco CRS-1 and Cisco XR 12000 Series Router.

 

This command replaced the set extcommunity command.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the set extcommunity cost command to either replace the extended communities on the route or add to them using the optional additive keyword.


Note The set extcommunity cost command can be used as an action statement within an if statement. For a list of all action statements available within an if statement, see the if command.


As with the other extended community forms that support inline sets, either or both portions of the community can be parameterized. Similarly to regular communities, the additive keyword can be used to signify adding these extended communities to those that are already present, as opposed to replacing them.

Task ID
Task ID
Operations

route-policy

read, write


Examples

The following are incomplete configuration examples using the set extcommunity cost command:

RP/0/RP0/CPU0:router(config-rpl)# set extcommunity cost (10:24)
RP/0/RP0/CPU0:router(config-rpl)# set extcommunity cost (10:24, $as:24, $as:$tag)
RP/0/RP0/CPU0:router(config-rpl)# set extcommunity cost (10:24, internet) additive
RP/0/RP0/CPU0:router(config-rpl)# set extcommunity cost (10:24, $as:24) additive

Without the additive keyword, any existing extended communities for cost (other than the well-known communities) are removed and replaced with the given communities. The additive keyword specifies that all extended communities for cost already present in the route be maintained and the list of extended communities be added to them.

set extcommunity rt

To set the Border Gateway Protocol (BGP) extended community attribute for a route target (RT), use the set extcommunity rt command in route-policy configuration mode.

set extcommunity rt {rt-extcommunity-set-name | rt-inline-extcommunity-set} [additive]

Syntax Description

rt-extcommunity-set-name

Route target extended community set name.

rt-inline-extcommunity-set

Inline route target extended community set.

additive

(Optional) Adds extended communities for an RT to extended communities in the route.


Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 3.3

This command was introduced on the Cisco CRS-1 and Cisco XR 12000 Series Router.

 

This command replaced the set extcommunity command.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the set extcommunity rt command to either replace the extended communities on the route or add to them using the optional additive keyword.


Note The set extcommunity rt command can be used as an action statement within an if statement. For a list of all action statements available within an if statement, see the if command.


As with the other extended community forms that support inline sets, either or both portions of the community can be parameterized. Similarly to regular communities, the additive keyword can be used to signify adding these extended communities to those that are already present, as opposed to replacing them.

Task ID
Task ID
Operations

route-policy

read, write


Examples

The following are incomplete configuration examples using the set extcommunity rt command:

RP/0/RP0/CPU0:router(config-rpl)# set extcommunity rt (10:24)
RP/0/RP0/CPU0:router(config-rpl)# set extcommunity rt (10:24, $as:24, $as:$tag)
RP/0/RP0/CPU0:router(config-rpl)# set extcommunity rt (10:24, internet) additive
RP/0/RP0/CPU0:router(config-rpl)# set extcommunity rt (10:24, $as:24) additive

Without the additive keyword, any existing extended communities for cost (other than the well-known communities) are removed and replaced with the given communities. The additive keyword specifies that all extended communities for cost already present in the route be maintained and the list of extended communities be added to them.

set isis-metric

To set the Intermediate System-to-Intermediate System (IS-IS) metric attribute value, use the set is-is metric command in route-policy configuration mode.

set isis-metric {number | parameter}

Syntax Description

number

24-bit integer number. Range is from 0 to 16777215.

parameter

Parameter name. The parameter name must be preceded with a "$."


Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 3.3

This command was introduced on the Cisco CRS-1 and Cisco XR 12000 Series Router.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the set isis-metric command to set the IS-IS metric attribute value for routes that are redistributed into IS-IS.

Task ID
Task ID
Operations

route-policy

read, write


Examples

In the following example, the IS-IS metric attribute value is set to 1000:

RP/0/RP0/CPU0:router(config)# route-policy policy_1
RP/0/RP0/CPU0:router(config-rpl)# set isis-metric 1000
RP/0/RP0/CPU0:router(config-rpl)# end-policy

set label

To set the Border Gateway Protocol (BGP) label attribute value, use the set label command in route-policy configuration mode.

set label {explicit-null | implicit-null | parameter}

Syntax Description

explicit-null

Sets the label to a well-known explicit value.

implicit-null

Sets the label to a well-known implicit value.

parameter

Parameter name. The parameter name must be preceded with a "$."


Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 3.3

This command was introduced on the Cisco CRS-1 and Cisco XR 12000 Series Router.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the set label command to set the BGP label for VPN IPv4 routes. During inter-AS operation, the ASBR sends some of its own loopbacks to other its peers and labels them either implicit null or explicit null.

Examples

The following are incomplete configuration examples using the set label command:

RP/0/RP0/CPU0:router(config-rpl)# set label implicit-null
RP/0/RP0/CPU0:router(config-rpl)# set label explicit-null
RP/0/RP0/CPU0:router(config-rpl)# set label $label

set level

To configure the integrated Intermediate System-to-Intermediate System (IS-IS) level in which redistributed routes should be sent, use the set level command in route-policy configuration mode.

set level {level-1 | level-2 | level-1-2 | parameter}

Syntax Description

level-1

Uses Level 1 to match Level 1 IS-IS routes.

level-2

Uses Level 2 to match Level 2 IS-IS routes.

level-1-2

Uses Level 1-2 to match either Level 1 or Level 2 IS-IS routes.

parameter

Parameter name. The parameter name must be preceded with a "$."


Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 2.0

This command was introduced on the Cisco CRS-1.

Release 3.0

No modification.

Release 3.2

This command was supported on the Cisco XR 12000 Series Router.

Release 3.3

No modification.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the IS-IS set level command to configure the IS-IS level in which redistributed routes should be sent.


Note The set level command can be used as an action statement within an if statement. For a list of all action statements available within an if statement, see the if command.


This command supports parameterization of the level keyword.

Task ID
Task ID
Operations

route-policy

read, write


Examples

In the following example, the level is set to Level 1:

RP/0/RP0/CPU0:router(config-rpl)# set level level-1

set local-preference

To set the Border Gateway Protocol (BGP) local preference attribute in a route, use the set local-preference command in route-policy configuration mode.

set local-preference {number | parameter}

Syntax Description

number

Value assigned to a 32-bit unsigned integer. Range is 0 to 4294967295.

parameter

Parameter name. The parameter name must be preceded with a "$."


Defaults

Default value is 100.

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 2.0

This command was introduced on the Cisco CRS-1.

Release 3.0

No modification.

Release 3.2

This command was supported on the Cisco XR 12000 Series Router.

Release 3.3

No modification.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the set local-preference command to specify a preference value for the autonomous system path. Local preference is a nontransitive (does not cross autonomous system boundaries) attribute and is the second metric considered in the BGP best path calculation (the highest local preference is chosen). Weight is the first metric evaluated for best path, but it is local to the router and propagates only to iBGP peers. See the Implementing BGP on Cisco IOS XR Software module of the Cisco IOS XR Routing Configuration Guide for information on the BGP best path calculation.


Note The set local-preference command can be used as an action statement within an if statement. For a list of all action statements available within an if statement, see the if command.


The local preference is a 32-bit unsigned integer.

Task ID
Task ID
Operations

route-policy

read, write


Examples

In the following example, the local preference value is set to 10:

RP/0/RP0/CPU0:router(config-rpl)# set local-preference 10

set med

To set the Border Gateway Protocol (BGP) Multi Exit Discriminator (MED) attribute, use the set med command in route-policy configuration mode.

set med {number | parameter | igp-cost | {+ | -} {number | parameter} | max-reachable}

Syntax Description

number

Value assigned to a 32-bit unsigned integer. Range is 0 to 4294967295.

parameter

Parameter name. The parameter name must be preceded with a "$."

igp-cost

Sets the MED value to the cost for the Interior Gateway Protocol (IGP) route to resolve the next hop of the BGP route.

+ | -

Sets the MED to the MED plus or minus a static offset. An integer or parameter must follow the plus or minus.

max-reachable

Sets the MED value to the maximum possible value.


Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 2.0

This command was introduced on the Cisco CRS-1.

Release 3.0

No modification.

Release 3.2

This command was supported on the Cisco XR 12000 Series Router.

Release 3.3

No modification.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the set med command to set the MED value, which is a 32-bit unsigned integer.


Note The set med command can be used as an action statement within an if statement. For a list of all action statements available within an if statement, see the if command.


This command can take the following as argument values: an integer, a parameter, the igp-cost keyword, or a mathematical operator (either plus or minus) followed by an integer or a parameter.

The plus or minus variants allow the user to set the MED to the MED plus or minus a static offset. The variants that allow a user to add or subtract offsets to the MED value are also range checked for underflow or overflow. If the value underflows as a result of subtraction, then the MED value is set to zero. If the value overflows, the value is set to 4294967295, which is a special value for MED.

Task ID
Task ID
Operations

route-policy

read, write


Examples

The following two examples show how to set the MED to a value that is either specified directly (using the integer 156) or passed to the policy as a parameter:

RP/0/RP0/CPU0:router(config-rpl)# set med 156
RP/0/RP0/CPU0:router(config-rpl)# set med $med_param

The following example shows how to instruct BGP to automatically set the MED value to the cost of the IGP route that resolves the next hop of the BGP route:

RP/0/RP0/CPU0:router(config-rpl)# set med igp-cost

set metric-type (IS-IS)

To configure the integrated Intermediate System-to-Intermediate System (IS-IS) metric type, use the set metric-type command in route-policy configuration mode.

set metric-type {internal | external | parameter}

Syntax Description

internal

Sets metric type to internal.

external

Sets the metric type to external.

parameter

Parameter name. The parameter name must be preceded with a "$."


Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 2.0

This command was introduced on the Cisco CRS-1.

Release 3.0

No modification.

Release 3.2

This command was supported on the Cisco XR 12000 Series Router.

Release 3.3

No modification.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the IS-IS set metric-type command to control whether IS-IS treats the metric as an internal or external metric.


Note The set metric-type command can be used as an action statement within an if statement. For a list of all action statements available within an if statement, see the if command.


This command does not support parameterization.

Task ID
Task ID
Operations

route-policy

read, write


Examples

In the following example, the IS-IS metric type is set to internal:

RP/0/RP0/CPU0:router(config-rpl)# set metric-type internal

set metric-type (OSPF)

To control how Open Shortest Path First (OSPF) computes the cost for a route, use the set metric-type command in route-policy configuration mode.

set metric-type {type-1 | type-2}

Syntax Description

type-1

Uses the cost set on the route plus the topology-related costs in the calculation for Type 1 metrics.

type-2

Uses only the cost set on the route in the calculation for Type 2 metrics.


Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

Release
Modification

Release 2.0

This command was introduced on the Cisco CRS-1.

Release 3.0

No modification.

Release 3.2

This command was supported on the Cisco XR 12000 Series Router.

Release 3.3

No modification.


Usage Guidelines

To use this command, you must be in a user group associated with a task group that includes the proper task IDs. For detailed information about user groups and task IDs, see the Configuring AAA Services on Cisco IOS XR Software module of the Cisco IOS XR System Security Configuration Guide.

Use the OSPF set metric-type command to control whether OSPF treats the cost as a Type 1 or Type 2 metric.


Note The set metric-type command can be used as an action statement within an if statement. For a list of all action statements available within an if statement, see the if command.


The value of Type 1 or Type 2 controls how OSPF computes the cost for this route. For Type 2 metrics, only the cost set on the route is used. For Type 1 metrics, the cost set on the route plus the topology- related costs are used in the calculation.

This command does not support parameterization.

Task ID
Task ID
Operations

route-policy

read, write


Examples

In the following example, the OSPF metric type is set to Type 1:

RP/0/RP0/CPU0:router(config-rpl)# set metric-type type-1

set next-hop

To replace the next hop associated with a given route, use the set next-hop command in route-policy configuration mode.

set next-hop {ipv4-address | ipv6-address | peer-address | parameter}

Syntax Description

ipv4-address

Valid IPv4 address.

ipv6-address

Valid IPv6 address.

peer-address

Sets the next hop to the IP address of the remote Border Gateway Protocol (BGP) peer.

parameter

Parameter name. The parameter name must be preceded with a "$."


Defaults

No default behavior or values

Command Modes

Route-policy configuration

Command History

<
Release
Modification

Release 2.0