Specifications
Implementing BGP on Cisco IOS XR Software
Information About Implementing BGP on Cisco IOS XR Software
RC-29
Cisco IOS XR Routing Configuration Guide
9. If one path is received from an external peer and the other is received from an internal (or 
confederation) peer, the path from the external peer is chosen. (See Section 9.1.2.2d of 
draft-ietf-idr-bgp4-24.txt.)
10. If the paths have different IGP metrics to their next hops, the path with the lower IGP metric is 
chosen. (See Section 9.1.2.2e of draft-ietf-idr-bgp4-24.txt.)
11. If the paths have unequal IP cost communities, the path with the lower IP cost community is selected 
as the best path.
Note See the “BGP Cost Community” section on page RC-22 for details on how cost communities are 
compared.
12. If all path parameters in Step 1 through Step 10 are the same, then the router IDs are compared. If 
the path was received with an originator attribute, then that is used as the router ID to compare; 
otherwise, the router ID of the neighbor from which the path was received is used. If the paths have 
different router IDs, the path with the lower router ID is chosen. Note: where the originator is used 
as the router ID, it is possible to have two paths with the same router ID. It is also possible to have 
two BGP sessions with the same peer router, and therefore receive two paths with the same router 
ID. (See Section 9.1.2.2f of draft-ietf-idr-bgp4-24.txt.)
13. If the paths have different cluster lengths, the path with the shorter cluster length is selected. If a 
path was not received with a cluster list attribute, it is considered to have a cluster length of 0.
14. Finally, the path received from the neighbor with the lower IP address is chosen. Locally generated 
paths (for example, redistributed paths) are considered to have a neighbor IP address of 0. (See 
Section 9.1.2.2g of draft-ietf-idr-bgp4-24.txt.)
Order of Comparisons
The second part of the BGP best-path algorithm implementation determines the order in which the paths 
should be compared. The order of comparison is determined as follows:
1. The paths are partitioned into groups such that within each group the MED can be compared among 
all paths. The same rules as in the “Comparing Pairs of Paths” section on page RC-27 are used to 
determine whether MED can be compared between any two paths. Normally, this comparison results 
in one group for each neighbor AS. If the bgp bestpath med always command is configured, then 
there is just one group containing all the paths.
2. The best path in each group is determined. Determining the best path is achieved by iterating through 
all paths in the group and keeping track of the best one seen so far. Each path is compared with the 
best-so-far, and if it is better, it becomes the new best-so-far and is compared with the next path in 
the group.
3. A set of paths is formed containing the best path selected from each group in Step 2. The overall 
best path is selected from this set of paths, by iterating through them as in Step 2.
Best Path Change Suppression
The third part of the implementation is to determine whether the best-path change can be suppressed or 
not—whether the new best path should be used, or continue using the existing best path. The existing 
best path can continue to be used if the new one is identical to the point at which the best-path selection 
algorithm becomes arbitrary (if the router-id is the same). Continuing to use the existing best path can 
avoid churn in the network.










