BGP Cost Community
number (0–255) and cost community number (0–4294967295). The cost community number determines the
preference for the path. The path with the lowest cost community number is preferred. Paths that are not
specifically configured with the cost community number are assigned a default cost community number of
2147483647 (the midpoint between 0 and 4294967295) and evaluated by the best-path selection process
accordingly. When two paths have been configured with the same cost community number, the path selection
process prefers the path with the lowest cost community ID. The cost-extended community attribute is
propagated to iBGP peers when extended community exchange is enabled.
The following commands include the route-policy keyword, which you can use to apply a route policy that
is configured with the cost community set clause:
• aggregate-address
• redistribute
• network
How BGP Cost Community Influences the Best Path Selection Process
The cost community attribute influences the BGP best-path selection process at the point of insertion (POI).
By default, the POI follows the Interior Gateway Protocol (IGP) metric comparison. When BGP receives
multiple paths to the same destination, it uses the best-path selection process to determine which path is the
best path. BGP automatically makes the decision and installs the best path in the routing table. The POI allows
you to assign a preference to a specific path when multiple equal cost paths are available. If the POI is not
valid for local best-path selection, the cost community attribute is silently ignored.
Cost communities are sorted first by POI then by community ID. Multiple paths can be configured with the
cost community attribute for the same POI. The path with the lowest cost community ID is considered first.
In other words, all cost community paths for a specific POI are considered, starting with the one with the
lowest cost community. Paths that do not contain the cost community cost (for the POI and community ID
being evaluated) are assigned the default community cost value (2147483647). If the cost community values
are equal, then cost community comparison proceeds to the next lowest community ID for this POI.
To select the path with the lower cost community, simultaneously walk through the cost communities of both
paths. This is done by maintaining two pointers to the cost community chain, one for each path, and advancing
both pointers to the next applicable cost community at each step of the walk for the given POI, in order of
community ID, and stop when a best path is chosen or the comparison is a tie. At each step of the walk, the
following checks are done:
If neither pointer refers to a cost community,
Elseif a cost community is found for one path but not for the other,
Elseif the Community ID from one path is less than the other,
Elseif the Cost from one path is less than the other,
Else Continue.
Paths that are not configured with the cost community attribute are considered by the best-path selection
Note
process to have the default cost value (half of the maximum value [4294967295] or 2147483647).
Cisco ASR 9000 Series Aggregation Services Router Routing Configuration Guide, Release 5.1.x
34
Declare a tie;
Choose the path with cost community as best path;
Choose the path with the lesser Community ID as best path;
Choose the path with the lesser Cost as best path;
Implementing BGP
OL-30423-03