The if-match community-filter command configures a tunnel selector to use specified community filters.
The undo if-match community-filter command restores the default configuration.
By default, a tunnel selector does not use any community filter.
Parameter | Description | Value |
---|---|---|
basIndex |
Specifies the number of a basic community filter. |
The value is an integer ranging from 1 to 99. |
whole-match |
Matches routes against all the filtering rules of a community filter. This keyword applies only to basic community filters. The whole-match keyword applies only to the community filter before it. If multiple community filters are specified in the if-match community-filter command and you want to apply the whole-match keyword to all the filters, add the whole-match keyword after each community filter. Note that the whole-match keyword applies only to basic community filters. |
- |
AdvIndex |
Specifies the number of an advanced community filter. |
The value is an integer ranging from 100 to 199. |
sort-match |
Indicates sort matching. That is, all the communities in the command must be matched in sequence. Sort matching is valid only for the advanced community filter. The parameter sort-match is valid only for its front community filter. If multiple community filters are specified in the if-match community-filter command and packets are required to wholly match the regular expansion in the filter in sequence, you need to specify the parameter sort-match behind each community filter. |
- |
cfName |
Specifies the name of a community filter. |
The value is a string of 1 to 51 case-sensitive characters, spaces not supported. The string can contain spaces only if it is enclosed with double quotation marks (" "). A string containing only digits is not allowed. |
Usage Scenario
Community attributes are BGP-specific attributes. Therefore, the if-match community-filter command applies mainly to BGP routes. This command must be used with the ip community-filter command. For example:
Prerequisites
A community filter has been configured using the ip community-filter command.
A tunnel selector has been configured using the tunnel-selector command.Configuration Impact
BGP routes are filtered by community attribute. Those with the specified community attributes are permitted and those without the specified community attributes are denied.
Precautions
A maximum of 16 community filters can be specified in the if-match community-filter command.
The name of a community filter cannot be all numbers.<HUAWEI> system-view [~HUAWEI] ip community-filter 1 permit 100:200 [*HUAWEI] tunnel-selector test permit node 10 [*HUAWEI-tunnel-selector] if-match community-filter 1
<HUAWEI> system-view [~HUAWEI] ip community-filter basic aa permit 10 [*HUAWEI] tunnel-selector test permit node 12 [*HUAWEI-tunnel-selector] if-match community-filter aa
<HUAWEI> system-view [~HUAWEI] ip community-filter 1 permit 100:200 [*HUAWEI] ip community-filter 2 permit 300:400 [*HUAWEI] tunnel-selector test permit node 11 [*HUAWEI-tunnel-selector] if-match community-filter 1 whole-match 2 whole-match
<HUAWEI> system-view [~HUAWEI] ip community-filter 101 permit 10 [*HUAWEI] route-policy test permit node 13 [*HUAWEI-route-policy] if-match community-filter 101 sort-match