Unraveling the Mysteries of BGP Path Selection

In the grand tapestry of the internet, Border Gateway Protocol (BGP) plays the pivotal role of the postal service, ensuring data packets are delivered through the most efficient routes across autonomous systems (AS). Understanding how BGP makes routing decisions is crucial for network administrators aiming to optimize network performance and reliability. This blog post demystifies the BGP path selection process by detailing the 15 path selection attributes, listed in their order of priority.

The Backbone of the Internet: BGP

BGP is the standardized exterior gateway protocol designed to exchange routing and reachability information among autonomous systems on the internet. It’s the protocol behind the scenes, determining the best paths for data transmission.

BGP Path Selection: The Criteria

When multiple paths to the same destination are available, BGP uses a series of attributes to decide on the most preferable route. Here’s a breakdown of these attributes, ordered by their evaluation sequence:

  1. Weight: A Cisco-specific attribute, weight is considered the highest priority in the path selection process. It’s locally significant to the router, with higher weights preferred over lower ones.
  2. Local Preference (Local Pref): This attribute indicates the preferred path as determined by the network administrator. Unlike weight, Local Preference is shared across routers in the same AS. Higher values take precedence.
  3. Locally Originated: Paths that are originated by the local router through a direct connection, aggregate, or redistribution from an IGP are preferred.
  4. AS Path: Shorter AS Path lengths are favored, as they indicate a more direct route to the destination.
  5. Origin Type: The origin of the route can be IGP (Interior Gateway Protocol), EGP (Exterior Gateway Protocol), or incomplete. The preference order is IGP > EGP > incomplete.
  6. MED (Multi-Exit Discriminator): Also known as the metric, MED is a suggestion to external neighbors about the preferred path into an AS. Lower values are preferred.
  7. Prefer eBGP over iBGP paths: External BGP (eBGP) paths are preferred over internal BGP (iBGP) paths.
  8. IGP Metric: For routes that are equal up to this point, the path with the lowest IGP metric to the BGP next hop is chosen.
  9. eBGP Peering: Given the choice, BGP prefers paths that were learned from a directly connected external neighbor.
  10. Oldest Path: Among equally viable paths, the one that was learned first (the oldest) is preferred.
  11. Router ID: If all other attributes are equal, the path from the BGP router with the lowest router ID is preferred.
  12. Minimum Cluster List Length: In route reflection scenarios, paths with the shortest cluster list are preferred.
  13. Minimum Neighbor Address: Finally, if all else is equal, the path through the neighbor with the lowest IP address is chosen.

Beyond the Attributes: Strategic Path Selection

Understanding and leveraging these attributes allow network administrators to craft routing strategies that enhance network efficiency and reliability. For instance, manipulating the AS Path attribute through AS path prepending or adjusting the Local Preference values can influence inbound or outbound traffic flows, respectively.

Conclusion: Mastering BGP for Network Excellence

The ability to influence BGP path selection is a powerful tool in the network administrator’s arsenal. By mastering these attributes and their implications, professionals can ensure optimal data routing, enhancing the performance and stability of their networks. In the ever-evolving landscape of network engineering, a deep understanding of BGP’s inner workings is indispensable for navigating the complexities of the internet’s backbone.