BGP selects a single best path to a destination, and inserts it in the IP routing table. IP datagrams are only forwarded based on routes in the IP table, NOT by the routes in the BGP table.
Since each distinct prefix is a unique destination, BGP will select and advertise only a single best path. To decide which is the 'best path', BGP uses an extensive tie-breaking algorithm. At each step, BGP seeks to break a tie between metrics. The selection process ends at the point where a tie between routes is broken by a better metric. The metrics used are as follows:
BEST PATH ALGORITHM
- The first path received is automatically the 'best path'. Any further paths received are compared to this path to determine if the new path is 'best'.
- Is the route VALID? To be valid:
- The route must be synchronized with the Interior Gateway Protocol (unless synchronization is turned off).
- The route must appear in the IP routing table (see previous bullet point).
- The NEXT_HOP must be reachable.
- The AS_PATHs received from an external AS must not contain the local AS, or they will be discarded.
- The local routing policy must permit the route. If the neighbor is filtering the route, they won't use it.
- Highest WEIGHT
Weight is a Cisco-proprietary setting and only exists on the router on which it is configured. It is otherwise useless throughout an AS. - Highest LOCAL_PREF (used within an AS)
- Prefer LOCALLY ORIGINATED route (originated from this router)
- Shortest AS-PATH
- Lowest ORIGIN type:
IGP < EGP < INCOMPLETE - Lowest MULTI-EXIT-DISCRIMINATOR (MED)
- Prefer eBGP route over iBGP route
- Lowest IGP metric to BGP NEXT_HOP
- Prefer FIRST RECEIVED EXTERNAL ROUTE (prefer the OLDEST external PATH)
- Prefer lowest router ID
The Cisco router ID is IP address of the router, which in turn is the highest IP address on the router, or its Loopback Interface if it has one. - Minimum CLUSTER_ID length
- Lowest neighbor address
From this list, you can see it is impossible for two BGP routes to TIE each other and become equally preferred. As has been stated elsewhere in this site, BGP contains only a single best path to any given destination. BGP runs across the entire Internet, therefore it must manage to reduce the number of advertised routes in order to prevent the Internet from becoming flooded with route advertisement traffic. Thus, this algorithm is designed to eliminate all but 1 route to a destination.