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-global
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
path-type is
policy-global
prefix-set
prepend as-path
protocol
rd in
rd-set
replace as-path
rib-has-route
route-has-label
route-policy (RPL)
route-type is
rpl editor
rpl maximum
set community
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 vpn-distinguisher
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 rd-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 rd-set
show rpl rd-set attachpoints
show rpl rd-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 rd-set
show rpl unused route-policy
source in
suppress-route
tag (policy)
unsuppress-route
vpn-distinguisher is
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 the appropriate 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
Route distinguisher set configuration
AS path set configuration
Community set configuration
Extended community set configuration
Command History
Release
|
Modification
|
Release 3.3.0
|
This command was introduced on the Cisco CRS-1 and Cisco XR 12000 Series Router.
|
Release 3.4.0
|
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.
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
|
as-path-set
|
Enters AS path set configuration mode and defines an AS path set.
|
community-set
|
Enters community set configuration mode and defines a community set.
|
extcommunity-set rt
|
Enters extended community rt set configuration mode and defines an extended community set.
|
extcommunity-set soo
|
Enters extended community soo set configuration mode and defines an extended community set.
|
prefix-set
|
Enters prefix set configuration mode and defines a prefix set.
|
rd-set
|
Enters rd set configuration mode and defines a route distinguisher set.
|
route-policy (RPL)
|
Enters route policy configuration mode.
|
add
To add a value to an Routing Information Protocol (RIP) or Enhanced Interior Gateway Protocol (EIGRP) existing metric, use the add command in route-policy configuration mode.
add {eigrp-metric bandwidth delay reliability loading max-transmission | rip-metric {number |
parameter}}
Syntax Description
eigrp-metric
|
Specifies an EIGRP metric attribute.
|
bandwidth
|
Bandwidth in kilobits per second. Range is from 0 to 4294967295.
|
delay
|
Delay in 10-microsecond units. Range is from 0 to 4294967295.
|
reliability
|
Reliability metric. 255 is 100-percent reliable. Range is from 0 to 255.
|
loading
|
Effective bandwidth (loading). 255 is 100-percent loaded. Range is from 0 to 255.
|
max-transmission
|
Maximum transmission of the path. Range is from 0 to 65535.
|
rip-metric
|
Specifies an 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.0
|
This command was introduced on the Cisco CRS-1 and Cisco XR 12000 Series Router.
|
Release 3.4.0
|
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 the add value is greater than the maximum allowed value, the metric is added. If the resulting metric exceeds the maximum for the routing protocol, then the route is dropped (by the client routing protocol).
Task ID
Task ID
|
Operations
|
route-policy
|
read, write
|
Examples
The following example shows how to offset the RIP metric value:
RP/0/RP0/CPU0:router(config)# route-policy policy_1
RP/0/RP0/CPU0:router(config-rpl)# add rip-metric 4
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.0
|
No modification.
|
Release 3.4.0
|
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 | parameter}
Syntax Description
as-path-set-name
|
Name of an AS path set.
|
inline-as-path-set
|
Inline AS path set. The inline AS path set must be enclosed in parentheses.
|
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.0
|
No modification.
|
Release 3.4.0
|
The parameter argument was added.
|
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 Border Gateway Protocol (BGP) 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.0
|
No modification.
|
Release 3.4.0
|
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 Border Gateway Protocol (BGP) 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.0
|
No modification.
|
Release 3.4.0
|
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 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 autonomous system numbers at the head of the AS path against a sequence of one or more values or parameters, 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 for 2-byte numbers is 1 to 65535. Range for 4-byte numbers is 1.0 to 65535.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.0
|
No modification.
|
Release 3.4.0
|
The as-number-list 4-byte number range 1.0 to 65535.65535 was supported.
|
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
and an AS path beginning:
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 for 2-byte numbers is 1 to 65535. Range for 4-byte numbers is 1.0 to 65535.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.0
|
No modification.
|
Release 3.4.0
|
The as-number-list 4-byte number range 1.0 to 65535.65535 was supported.
|
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
and an autonomous system path ending
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 for 2-byte numbers is 1 to 65535. Range for 4-byte numbers is 1.0 to 65535.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.0
|
No modification.
|
Release 3.4.0
|
The as-number-list 4-byte number range 1.0 to 65535.65535 was supported.
|
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
and an AS path containing:
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.0
|
No modification.
|
Release 3.4.0
|
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 (match against the number of unique ASNs in 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.0
|
No modification.
|
Release 3.4.0
|
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 match 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 check 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.0
|
No modification.
|
Release 3.4.0
|
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 check 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 | parameter}
Syntax Description
community-set-name
|
Name of a community set.
|
inline-community-set
|
Inline community set. The inline community set must be enclosed in parentheses.
|
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 BGP community matching operators were enhanced to allow comparisons on ranges and regular expressions.
|
Release 3.3.0
|
No modification.
|
Release 3.4.0
|
The parameter argument was added.
|
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:
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(confi