BGP Decision Process – OSPF, BGP, and Route Manipulation
By default, BGP selects only a single path to reach a specific destination (unless you specify maximum paths). The Cisco implementation of BGP uses a simple decision process. When the path is selected, BGP puts the selected path in its routing table and propagates the path to its neighbors.
To select the best path to a destination, Cisco routers running BGP use the following algorithm in the following order:
If the specified next hop is inaccessible, drop the path.
If the path is internal, and synchronization is enabled, and the path is not in the IGP, drop the path.
Prefer the path with the highest weight. (This step is Cisco specific, and weight is localized to the router.)
Prefer the path with the highest local preference. iBGP uses this path only to reach the preferred external BGP router.
Prefer the path that was locally originated via a network or aggregate BGP subcommand or through redistribution from an IGP. Local paths sourced by network or redistribute commands are preferred over local aggregates sourced by the aggregate-address command. (This step is Cisco specific.)
If no route was originated, prefer the route that has the shortest AS_Path.
If all paths have the same autonomous system path length, prefer the path with the lowest origin type. Paths with an origin type of IGP (lower) are preferred over paths originated from an EGP such as BGP, and EGP origin is preferred over a route with an incomplete origin. (IGP < EGP < incomplete.)
If the origin codes are the same, prefer the path with the lowest MED attribute. An eBGP peer uses this attribute to select a best path to the autonomous system. This attribute is exchanged between autonomous systems. (This step is a tiebreaker, as described in RFC 4271xxx.)
If the paths have the same MED, prefer the external (eBGP) path over the internal (iBGP) path.
If the paths are still the same, prefer the path through the closest IGP neighbor (best IGP metric). (This step is a tiebreaker, as described in RFC 4271xxx.)
Prefer the oldest known path.
Prefer the path with the BGP neighbor with the lowest BGP router ID. (The RFC that defines the BGP describes the router ID.)
Prefer the path with the minimum cluster list length.
Prefer the path with the lowest neighbor IP address.
After BGP decides on a best path, it marks that path with a > sign in the output of the show ip bgp command and adds it to the IP routing table.
Note
Options for influencing outbound routing decisions include weight, local preference, and AS path length. Options for influencing inbound routing decisions include AS path length, BGP communities, and MED.
Table 4-8 shows a summary of the BGP best path order.
Table 4-8 BGP Best Path Order
BGP Best Path Order |
Highest weight |
Highest local preference |
Prefer local originated route |
Shortest AS_Path |
Lowest origin type |
Lowest MED |
Prefer eBGP over iBGP |
Lowest IGP metric to the BGP next hop |
Oldest path |
Lowest BGP router ID source |
Minimum cluster list length |
Lowest neighbor address |