ip community-filter
Function
The ip community-filter command creates a community filter.
The undo ip community-filter command deletes a community filter.
By default, no community filter is configured.
Format
ip community-filter { basic comm-filter-name | basic-comm-filter-num } { permit | deny } [ community-number | aa:nn | internet | no-export-subconfed | no-advertise | no-export ] &<1-20>
ip community-filter { advanced comm-filter-name | adv-comm-filter-num } { permit | deny } regular-expression
undo ip community-filter { basic comm-filter-name | basic-comm-filter-num } [ permit | deny ] [ community-number | aa:nn | internet | no-export-subconfed | no-advertise | no-export ] &<1-20>
undo ip community-filter { advanced comm-filter-name | adv-comm-filter-num } [ permit | deny ] [ regular-expression ]
Parameters
Parameter | Description | Value |
---|---|---|
basic comm-filter-name | Specifies the name of a basic community filter. | The value is a string of 1 to 51 case-sensitive characters. The string cannot be all digits. |
basic-comm-filter-num | Specifies the number of a basic community filter. | The value is an integer ranging from 1 to 99. |
deny | Sets the matching mode of the community filter to deny. | - |
permit | Sets the matching mode of the community filter to permit. | - |
community-number | Specifies the community number. | The value is an integer ranging from 0 to 4294967295. |
aa:nn | Specifies the community number. You can configure
a maximum of 20 community numbers once.
|
aa and nn are integers ranging from 0 to 65535. |
internet | Indicates that the matching routes can be sent to any peer. | - |
no-export-subconfed | Indicates that routes are not advertised outside an AS. If an AS confederation is used, routes are not advertised to any other sub-ASs in the AS confederation. | - |
no-advertise | Indicates that routes are not advertised to other peers. | - |
no-export | Indicates that routes are not advertised outside an AS. If an AS confederation is used, routes are not advertised outside the AS confederation, but to other sub-ASs. | - |
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. |
adv-comm-filter-num | Specifies the number of an advanced community filter. | The value is an integer ranging from 100 to 199. |
regular-expression | Specifies the regular expression used to match the community information. | The value is a string of 1 to 255 case-sensitive characters, with spaces supported. |
Usage Guidelines
Usage Scenario
The community attribute is a private attribute of BGP, and can be used only to filter BGP routes. The community attribute can be used as a matching rule of a routing policy by using the ip community-filter and if-match community-filter commands together.
The relationship between ip community-filter commands with the same community filter number specified is "AND".
Precautions
Only the community number or known community attribute can be specified for a basic community filter. The regular expression can be used as a matching rule in an advanced community filter.
The ip community-filter basic comm-filter-name command or the ip community-filter basic-comm-filter-num command can be used to configure a basic community filter. basic comm-filter-name specifies the name of a basic community filter, and the name cannot be all digits. A maximum of 20 community numbers can be configured in one command. basic-comm-filter-num specifies only the basic community filter with the number ranging from 1 to 99. A maximum of 20 community numbers can be configured in one command.
The ip community-filter advanced comm-filter-name command or the ip community-filter adv-comm-filter-num command can be used to configure an advanced community filter. advanced comm-filter-name specifies the name of an advanced community filter, and the name cannot be all digits. adv-comm-filter-num specifies only the advanced community filter with the number ranging from 100 to 199.
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 ip community-filter command multiple times. If multiple community attributes are specified in one filter, none of them can be deleted. For information about examples, see apply comm-filter delete.
Follow-up Procedure
Run the display ip community-filter command to view detailed configuration for the community filter.