Topic starter
The BGP path selection process involves several steps and criteria that a BGP router uses to determine the best path to a destination. Here is a detailed explanation of the BGP path selection process:
BGP Path Selection Criteria
-
Highest Weight:
- The path with the highest weight is preferred. Weight is a Cisco-specific parameter and is local to the router on which it is configured. It is not propagated to other routers.
-
Highest Local Preference:
- The path with the highest local preference is preferred. Local preference is a well-known discretionary BGP attribute and is used within an autonomous system (AS) to prefer one path over others.
-
Locally Originated:
- Paths that are originated by the local router (indicated by the
network
oraggregate
BGP subcommands) are preferred over paths received from other routers.
- Paths that are originated by the local router (indicated by the
-
Shortest AS Path:
- The path with the shortest AS path is preferred. The AS path length is the number of ASes the route has traversed. This helps avoid routing loops and generally indicates a shorter path.
-
Lowest Origin Type:
- The origin attribute indicates how BGP learned about the route. The preference order is: IGP (
i
), EGP (e
), and Incomplete (?
), where IGP is preferred over EGP, and EGP is preferred over Incomplete.
- The origin attribute indicates how BGP learned about the route. The preference order is: IGP (
-
Lowest Multi-Exit Discriminator (MED):
- The path with the lowest MED is preferred. MED is used to influence inbound traffic from neighboring ASes and is propagated between different ASes.
-
eBGP over iBGP Paths:
- Paths learned from eBGP peers are preferred over paths learned from iBGP peers. This preference helps ensure that the path with the shortest external route is used.
-
Lowest IGP Metric to the BGP Next-Hop:
- The path with the lowest IGP metric to the BGP next-hop is preferred. This means that the path which is closest (in terms of IGP cost) to the next-hop router is chosen.
-
Oldest Path:
- If multiple paths are still equal after considering all the above criteria, the oldest path (the one that has been in the BGP table the longest) is preferred. This helps ensure stability by reducing route flapping.
-
Lowest BGP Router ID:
- If paths are still equal, the path with the lowest BGP router ID is preferred. The router ID is a unique identifier for the BGP router, usually the highest IP address on the router or a manually configured value.
-
Lowest Neighbor Address:
- If all else is equal, the path with the lowest neighbor IP address (the IP address of the BGP peer) is preferred.
Example Scenario
Imagine a BGP router has received multiple routes to the same destination from different BGP peers. Here's how it might select the best path:
- Check Weight: If one path has a higher weight than the others, it is chosen.
- Check Local Preference: If weights are equal, the router checks local preference. The path with the highest local preference is chosen.
- Check Origin: If local preferences are equal, the router checks if any of the routes were originated locally.
- Check AS Path Length: If local origination is equal, the router checks the AS path length and prefers the shortest one.
- Check Origin Type: If AS paths are equal, the router checks the origin type and prefers IGP over EGP, and EGP over Incomplete.
- Check MED: If origin types are equal, the router checks the MED and prefers the lowest value.
- Check eBGP over iBGP: If MEDs are equal, the router prefers eBGP paths over iBGP paths.
- Check IGP Metric to Next-Hop: If the eBGP/iBGP status is equal, the router checks the IGP metric to the BGP next-hop and prefers the lowest metric.
- Check Oldest Path: If IGP metrics are equal, the router checks which path has been in the BGP table the longest and prefers it.
- Check Router ID: If paths are still equal, the router checks the BGP router ID and prefers the lowest ID.
- Check Neighbor Address: If router IDs are equal, the router checks the neighbor IP address and prefers the lowest one.
Posted : 03/08/2024 1:26 am