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.
Product |
Support |
---|---|
S5720-EI, S5720-HI, S5720I-SI, S5720S-SI, S5720-SI, S5735-S, S5735S-S, S5735-S-I, S5730-HI, S5730S-EI, S5730-SI, S5731-H, S5731-S, S5731S-H, S5731S-S, S5732-H, S6720-EI, S6720-HI, S6720S-EI, S6720S-SI, S6720-SI, S6730-H, S6730S-H, S6730-S, and S6730S-S |
Supported. |
S2720-EI, S5720-LI, S5735-L, S5735S-L, S5735S-L-M, S5720S-LI, S6720-LI, and S6720S-LI |
Not supported. |
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 ]
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. When double quotation marks are used around the string, spaces are allowed in the string. |
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 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.
Configuration Impact
Multiple rules (permit or deny) can be specified in a filter.
By default, AS_Path filters work in deny mode. If all matching rules in a filter are configured to work in deny mode, all routes are denied by the filter; to prevent this problem, configure one matching rule in permit mode after one or multiple matching rules in deny mode so that the routes except for those denied by preceding matching rules are permitted by the filter.
Before you run the undo ip as-path-filter command to delete an AS_Path filter that is referenced by another command, delete the reference configuration.
Follow-up Procedure
To view detailed configurations of the AS_Path filter, run the display ip as-path-filter command.
# Create the AS_Path filter with the sequence number being 1, and permit routes that begin with 10 in the AS_Path to pass.
<HUAWEI> system-view
[HUAWEI] ip as-path-filter 1 permit ^10_
# Create the AS_Path filter 2, and permit routes that contain 20 in the AS_Path to pass through.
<HUAWEI> system-view
[HUAWEI] ip as-path-filter 2 permit _20_
# Create the AS_Path filter 3, and prohibit routes that contain 30 in the AS_Path from passing through.
<HUAWEI> system-view
[HUAWEI] ip as-path-filter 3 deny _30_
[HUAWEI] ip as-path-filter 3 permit .*