Border Gateway Protocol (BGP) uses a set of criteria to determine the best path for routing traffic between different networks on the internet. Here’s a simplified breakdown of the BGP path selection criteria:
-
Highest Weight: This is a Cisco-specific attribute. The path with the highest weight is preferred. Weight is a local attribute and not propagated to other routers.
-
Highest Local Preference: Local preference is used to prefer an exit point from the AS (Autonomous System). The path with the highest local preference value is preferred.
-
Shortest AS Path: The path with the fewest number of AS hops is preferred. This metric counts the number of ASes the route has traversed.
-
Lowest Origin Type: BGP routes can have different origin types: IGP (Interior Gateway Protocol), EGP (Exterior Gateway Protocol), and INCOMPLETE. Routes with an origin type of IGP are preferred over EGP, and EGP is preferred over INCOMPLETE.
-
Lowest Multi-Exit Discriminator (MED): MED is used to convey to external neighbors the preferred path into an AS. A lower MED value is preferred.
-
eBGP over iBGP: Routes learned via eBGP (External BGP) are preferred over routes learned via iBGP (Internal BGP) due to the external nature of the routes.
-
Lowest IGP Metric to BGP Next Hop: This criterion evaluates the shortest path to the BGP next hop within the local AS. The route with the lowest IGP metric to the next hop is preferred.
-
Oldest Route (when other criteria are equal): If all other criteria are equal, BGP prefers the route that has been in the BGP table the longest, or the route with the oldest age.
-
Router ID: As a last resort, if all other criteria are equal, BGP might choose the path with the lowest router ID.