The apply community command configures BGP community attributes.
The undo apply community command cancels the configuration.
By default, no BGP community attributes are configured.
apply community none
apply community { community-number | aa:nn | internet | no-advertise | no-export | no-export-subconfed } &<1-32> [ additive ]
undo apply community
| Parameter | Description | Value |
|---|---|---|
| none | Indicates that all the community attributes of routes are deleted. | - |
| community-number | Specifies the community number. | It is an integer ranging from 0 to 4294967295. |
| aa:nn | Specifies the community number. | Both aa and nn are integers ranging from 0 to 65535. |
| internet | Indicates that matching routes are sent to any peer. | - |
| no-advertise | Indicates that matching routes are not sent to any peer. | - |
| no-export | Indicates that matching routes are sent to other sub-ASs but not to other ASs. | - |
| no-export-subconfed | Indicates that matching routes are neither sent to other sub-ASs nor to other ASs. | - |
| additive | Indicates that community attributes are added to matching routes. | - |
A maximum of 32 community attributes can be configured in the apply community command.
Usage Scenario
The community attribute, which is the private attribute of BGP, simplifies the application of routing policies and facilitates route maintenance and management. A community is a set of destination addresses with the same characteristics. These addresses have no physical boundary and are independent of their ASs. They share one or multiple community attributes, which can be changed or set through the apply community command.
Prerequisites
Before running the apply community command, you need to configure a route-policy.
Configuration Impact
If the apply community command is configured in a route-policy, the community attributes of the BGP routes that match the route-policy are changed according to the configurations in the route-policy.
Assume that the original community name of a BGP route is 30. If this BGP route matches a certain route-policy, the AS number is replaced or added on the basis of the route-policy. For example:
# Configure a route-policy named setcommunity, match the route with the AS_path filter being 8, and change its community attribute to no-export.
<sysname> system-view
[sysname] route-policy setcommunity permit node 16
[sysname-route-policy] if-match as-path-filter 8
[sysname-route-policy] apply community no-export