< Home

if-match community-filter

Function

The if-match community-filter command creates a matching rule based on the community filter.

The undo if-match community-filter command deletes the matching rule based on the specified community filter.

By default, no matching rule based on the community 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.

Format

if-match community-filter { basic-comm-filter-num [ whole-match ] | adv-comm-filter-num } &<1-16>

if-match community-filter comm-filter-name [ whole-match ]

undo if-match community-filter [ basic-comm-filter-num | adv-comm-filter-num ] &<1-16>

undo if-match community-filter comm-filter-name

Parameters

Parameter Description Value

basic-comm-filter-num

Specifies the number of a basic community filter.

The value is an integer ranging from 1 to 99.

adv-comm-filter-num

Specifies the number of an advanced community filter.

The value is an integer ranging from 100 to 199.

comm-filter-name

Specifies the name of a community 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.

whole-match

Indicates complete matching. That is, all the communities in the command must be matched. Complete matching is valid only for the basic community filter.

-

Views

Route-Policy view

Default Level

2: Configuration level

Usage Guidelines

Usage Scenario

The community attribute is a private attribute of BGP. The if-match community-filter command is applicable to only BGP routes. The ip community-filter command must be used to define a community filter so that the matching rule based on this community filter can take effect. For example:

  • If the if-match community-filter 1 command is used but community filter 1 is not configured, all routes are permitted, that is, all routes can match the matching rule.
  • If the if-match community-filter 1 command is used after the ip community-filter 1 permit 1:1 command is used, the BGP routes with the community attribute being 1:1 are permitted.

Multiple if-match community-filter clauses can be specified. The relationship between if-match community-filter clauses is "OR". The relationship between if-match clauses is "AND".

Prerequisites

Before using the if-match community-filter command, you must use the ip community-filter command to configure a community filter.

The if-match community-filter command can be used only after a routing policy is configured.

Precautions

The routing policy matches routes using the community filter. Routes that match the community filter will be checked by other if-match clauses of this node. Routes that do not match the community filter will be checked by the next node.

A maximum of 16 community filters can be configured in the if-match community-filter command. The relationship between these community-filters is OR. Specifically, if a route matches one of these community-filters, it matches the matching rules of the command.

The parameter whole-match is valid only for its front community filter number. If multiple community filters are specified in the if-match community-filter command and packets are required to completely match each filter, you need to specify the parameter whole-match behind each community filter and it is valid to only the basic community filter.

The name of a community filter cannot be all numerals.

Creating a community attribute filter before it is referenced is recommended. By default, nonexistent community attribute filters cannot be referenced using the command. If the route-policy nonexistent-config-check disable command is run in the system view and a nonexistent community attribute filter is referenced using the current command, all routes match the community filter.

Example

# Set a matching rule that is based on the community filter 1.

<HUAWEI> system-view
[HUAWEI] ip community-filter 1 permit 100:200
[HUAWEI] route-policy test permit node 10
[HUAWEI-route-policy] if-match community-filter 1

# Set the complete matching rule for community attribute filters 1 and 2.

<HUAWEI> system-view
[HUAWEI] route-policy test permit node 11
[HUAWEI-route-policy] if-match community-filter 1 whole-match 2 whole-match

# Set a matching rule that is based on the community filter named aa.

<HUAWEI> system-view 
[HUAWEI] route-policy test permit node 12 
[HUAWEI-route-policy] if-match community-filter aa
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >