The apply community command sets the action for changing the community attribute of BGP routes in a routing policy.
The undo apply community command restores the default setting.
By default, the action for changing the community attribute of BGP routes is not set in a routing policy.
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. |
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 | aa:nn | Specifies the community number. A maximum of 32 community numbers can be configured in the apply community command.
|
The value of community-number is an integer ranging from 0 to 4294967295. The value of aa or nn ranges from 0 to 65535. |
internet | Indicates that matching routes are sent to any peer. By default, all routes belong to the Internet community. | - |
no-advertise | Indicates that matching routes are not sent to any peer. That is, after a router receives a route with this attribute, it does not advertise the route to other BGP peers. | - |
no-export | Indicates that matching routes are sent to other sub-ASs but not to other ASs. That is, after a router receives a route with this attribute, it does not advertise the route outside the local AS. | - |
no-export-subconfed | Indicates that matching routes are neither sent to other sub-ASs nor to other ASs. That is, after a router receives a route with this attribute, it does not advertise the route to other sub-ASs. | - |
additive | Indicates that community attributes are added to matching routes. | - |
Usage Scenario
To identify the BGP routes, you can apply a routing policy containing the apply community command to configure the community attribute of matched BGP routes.
The community attribute is a private attribute of BGP. It 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 by running the apply community command.
Prerequisites
The apply community command can be used only after the route-policy command is used.
Precautions
If the apply community command is configured in a routing policy, the community attributes of the BGP routes that match the routing policy are changed according to the configurations in the routing policy.
Assume that the original community attribute of a BGP route is 30. If this BGP route matches a certain routing policy, the AS number is replaced or added on the basis of the routing policy. For example:
# Configure a routing policy named setcommunity, match the route with the AS_Path filter being 8, and change its community attribute to no-export.
<HUAWEI> system-view
[HUAWEI] route-policy setcommunity permit node 16
[HUAWEI-route-policy] if-match as-path-filter 8
[HUAWEI-route-policy] apply community no-export