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 “$.” |
Command Default
No default behavior or values
Command Modes
Route-policy configuration
Usage Guidelines
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:
Router(config)# as-path-set my-as-set
Router(config-as)# ios-regex '_12$',
Router(config-as)# ios-regex '_13$'
Router(config-as)# end-set
and the following policy excerpt using an as-path-set-name argument:
Router(config-rpl)# if as-path in my-as-set then
Router(config-rpl-if)# set local-preference 100
Router(config-rpl-if)# endif
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:
Router(config-rpl)# if as-path in (ios-regex ‘_12$,ios-regex ‘_13$’) then
Router(config-rpl-if)# set local-preference 100
Router(config-rpl-if)# endif
Router(config-rpl)#