match as-path
Use this command to match a packet against its AS path attribute.
Syntax
match as-path as-path-string
no match as-path as-path-string
Parameters
as-path-string |
Specifies a string value to match against this packets AS path attribute. |
Mode
BGP route map configuration.
Usage
The match as-path command supports the following regular expressions:
- ^ - start of string (eg ^200 matches any string starting with 200)
- $ - end of string (eg 200$ matches any string ending with 200)
- . - matches any character (eg 2.0 match 200, 210, 220, etc)
- * - matches preceding element zero or more times (eg 22* matches 2, 22, 222, etc)
- .* - matches any character any number of times (i.e. this is a match all)
- [] - match a single character inside the brackets
- [-] - denotes a range (eg [0-9] matches any number from 0 to 9)
- () - a subexpression (eg (200:500) is treated as a single entity).
- [^] - match any single character not in brackets.
- ? - match preceding element zero or one time.
- + - match preceding element one or more times.
- | - choice operator matches either expression before or after operator.
The no match as-path command removes the match clause from this route map.
Example
This example shows how to match a packet AS path attribute that starts with AS number 20313 and with the next AS number ending with 13:
System(su)->configure
System(su-config)->route-map bgp bgprm1 permit
System(su-config-route-map-bgp)->match as-path ^20313.*13$
System(su-config-route-map-bgp)->show route-map bgprm1
route-map bgp bgprm1 permit 10
match afi ipv6
match safi unicast
match as-path "^20313_$13"
System(su-config-route-map-bgp)->