The ip community-filter advanced command adds an advanced community filter.
The undo ip community-filter advanced command deletes an advanced community filter.
By default, no advanced community filter exists.
Parameter | Description | Value |
---|---|---|
index index-number |
Specifies the sequence number of a basic community filter. |
The value is an integer ranging from 1 to 4294967295. |
matchMode |
Sets the matching mode of the community filter. |
The value is an enumerated type:
|
regular-expression |
Specifies a community-based regular expression. |
The value is a string of 1 to 1024 characters, spaces supported. |
advanced comm-filter-name |
Specifies the name of an advanced community filter. |
The value is a string of 1 to 51 case-sensitive characters. The string cannot be all digits. |
Usage Scenario
The community attribute is a private attribute of BGP and can be used to filter only BGP routes. The community attribute can be used as a matching condition of a route-policy using a command, such as the if-match community-filter command.
Follow-up Procedure
Run the display ip community-filter command to view detailed community filter configurations.
Precautions
Only a community number or well-known community attribute can be specified in a basic community filter. Only a regular expression can be specified as a matching rule in an advanced community filter.
The relationship between the rules of the community filter is "AND", which is different from that of an RD filter. This is because each route has only one RD but can have multiple communities. The apply comm-filter delete command run in the Route-Policy view deletes the specified community attribute from routes. An ip community-filter command can be used to specify community attributes but one such command specifies only one community attribute each time. To delete more than one community attribute, run the corresponding command multiple times. If multiple community attributes are specified in one filter, none of them can be deleted. For details, see the apply comm-filter delete command. By default, Community filters work in deny mode. If a route is not permitted, the route cannot pass the filter. If all filtering rules in a filter work in deny mode, all routes are denied by this filter. To prevent this problem, configure a filtering rule in permit mode after configuring one or more filtering rules in deny mode so that other routes can pass the filter. If an advanced community filter is used to filter routes, the community-based regular expression can be set to a character string in either the aa:nn format or integer format. For example: The ip community-filter advanced aa index 30 permit ^1:1$ configuration matches routes that carry the community value of 65537 or 1:1. The ip community-filter advanced aa index 30 permit ^65537$ configuration also matches routes that carry the community value of 65537 or 1:1.