if-match community-filter

Function

The if-match community-filter command sets a matching rule that is based on the community filter.

The undo if-match community-filter command cancels the configuration.

By default, no matching rule based on the community filter is set.

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 the basic community filter. The value is an integer ranging from 1 to 99.
adv-comm-filter-num Specifies the number of the advanced community filter. The value is an integer ranging from 100 to 199.
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. -
comm-filter-name Specifies the name of the community filter. The name is a string of 1 to 51 case-sensitive characters without any spaces. The string cannot be all numbers.
NOTE:
When double quotation marks are used around the string, spaces are allowed in the string.

Views

Route-policy view

Default Level

2: Configuration level

Usage Guidelines

Usage Scenario

The community attribute is a proprietary 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.

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 route-policy is configured by using the route-policy command.

Configuration Impact

When you filter routes based on the community attributes, the routes that match the matching rule are permitted and the routes that do not match the matching rule are denied.

Precautions

A maximum of 16 community filters can be configured in the if-match community-filter 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.

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 attribute filter.

Example

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

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

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

<sysname> system-view
[sysname] route-policy test permit node 11
[sysname-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.

<sysname> system-view
[sysname] route-policy test permit node 12
[sysname-route-policy] if-match community-filter aa
Related Topics
ip community-filter

Huawei Proprietary and Confidential
Copyright © Huawei Technologies Co., Ltd.