ip as-path-filter
Function
The ip as-path-filter command creates an AS_Path filter.
The undo ip as-path-filter command deletes a specified AS_Path filter.
By default, no AS_Path filter is configured.
Format
ip as-path-filter { as-path-filter-number | as-path-filter-name } { deny | permit } regular-expression
undo ip as-path-filter { as-path-filter-number | as-path-filter-name } [ { deny | permit } regular-expression ]
Parameters
Parameter | Description | Value |
---|---|---|
as-path-filter-number | Specifies the number of an AS_Path filter. | The value is an integer ranging from 1 to 256. |
as-path-filter-name | Specifies the name of an AS_Path filter. | The name is a string of 1 to 51 case-sensitive characters without spaces. The string cannot be all numerals. |
deny | Sets the matching mode of the AS_Path filter to deny. | - |
permit | Sets the matching mode of the AS_Path filter to permit. | - |
regular-expression | Specifies the AS_Path regular expression. | The value is a string of 1 to 255 characters, with spaces supported. |
Usage Guidelines
Usage Scenario
An AS_Path filter uses the regular expression to define matching rules. After an AS_Path filter is set, the RM module immediately instructs each protocol to apply the filter by default.
The AS_Path attribute is a private attribute of BGP, and is used to filter BGP routes.
The filter can be directly applied by using a command such as peer as-path-filter.
The filter can be used as a matching condition of a routing policy by using a command such as if-match as-path-filter zz.
The relationship between ip as-path-filter commands with the same AS_Path filter number specified is "AND".
Configuration Impact
Multiple rules (permit or deny) can be specified in a filter.
Follow-up Procedure
To view detailed configurations of the AS_Path filter, run the display ip as-path-filter command.
Example
# Create an AS_Path filter of which the sequence number is 1, and permit routes of which the AS_Path begins with 10 to pass filtering.
<AC6605> system-view
[AC6605] ip as-path-filter 1 permit ^10
# Create an AS_Path filter of which the sequence number is 2, and permit routes that contain 20 in the AS path to pass filtering.
<AC6605> system-view
[AC6605] ip as-path-filter 2 permit [ 20 ]
# Create an AS_Path filter of which the sequence number is 3, and prohibit routes that contain 30 in the AS path from passing filtering.
<AC6605> system-view
[AC6605] ip as-path-filter 3 deny [ 30 ]
[AC6605] ip as-path-filter 3 permit .*