The ip as-path-filter command adds an AS_Path filter.
The undo ip as-path-filter command deletes a specified AS_Path filter.
By default, no AS_Path filter exists.
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 value is a string of 1 to 51 case-sensitive characters, spaces not supported. The character string can contain spaces if it is enclosed in double quotation marks ("). |
index index-number |
Specifies the sequence number of an AS_Path filter. |
The value is an integer ranging from 1 to 4294967295. |
matchMode |
Sets the matching mode of the AS_Path filter. |
The value is an enumerated type:
|
regular-expression |
Specifies the AS_Path regular expression. |
The value is a string of 1 to 1024 characters, 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 mainly used to filter BGP routes.Configuration Impact
Multiple rules (in permit or deny mode) can be specified for a filter.
Follow-up Procedure
To view detailed configurations of an AS_Path filter, run the display ip as-path-filter command.
Precautions
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.
The AS number in regular expression of AS-path should be the same with 4-byte as-notation format of BGP, otherwise match will fail.
<HUAWEI> system-view [~HUAWEI] ip as-path-filter 2 permit _20_
<HUAWEI> system-view [~HUAWEI] ip as-path-filter 3 deny _30_ [*HUAWEI] ip as-path-filter 3 permit .*
<HUAWEI> system-view [~HUAWEI] ip as-path-filter 1 permit ^10_