Border Gateway Protocol (BGP), a core routing protocol of the Internet, determines the best path to route traffic based on various attributes and policies. When a BGP router has multiple paths to a specific destination, it uses the BGP path selection process to choose the best path. This process involves a series of criteria, typically evaluated in the following order:
-
Highest Weight: Weight is a Cisco-specific parameter and is local to the router. The path with the highest weight is preferred.
-
Highest Local Preference: Local Preference is a well-known discretionary attribute. Routes with a higher local preference are preferred over routes with a lower local preference.
-
Prefer the Path Originated Locally: Paths that the router originates have a higher priority.
-
Shortest AS Path: AS path is a well-known mandatory attribute. Paths with a shorter Autonomous System (AS) path are preferred.
-
Lowest Origin Type: The origin attribute indicates how BGP learned about a particular route. The order of preference is: IGP < EGP < Incomplete.
-
Lowest MED (Multi-Exit Discriminator): MED is a non-transitive optional attribute. Lower MED values are preferred. This is only compared between routes from the same AS.
-
Prefer eBGP over iBGP Paths: External BGP (eBGP) learned routes are preferred over internal BGP (iBGP) learned routes.
-
Shortest IGP Path to BGP Next Hop: The path with the shortest internal path to the next hop is preferred.
-
Oldest Path for eBGP Routes: The eBGP path that has been known for the longest time is preferred.
-
Router ID and Neighbor Address: If all the above criteria are the same, the BGP router ID and then the neighbor’s IP address are used as tie-breakers, preferring the path through the BGP router with the lowest router ID or the lowest neighbor address.
Important Notes: #
- Policy-Based Decisions: BGP is unique compared to other routing protocols because its decision process can be heavily influenced by network policies set by the network administrator.
- Customization: Administrators can manipulate BGP path selection through route maps, prefix lists, and various other BGP attributes.
- Local Configuration: Some steps in the BGP best path selection process (like weight) are not part of the BGP standard and can vary between implementations.
Understanding the BGP path selection process is crucial for network engineers and administrators, especially when troubleshooting or optimizing network routing and performance.