BGP Path Selection Logic
The Hierarchical Decision Algorithm
Introduction to BGP Decision Making
Unlike Interior Gateway Protocols (IGPs) like OSPF or EIGRP, which typically use a simple metric like cost or bandwidth, the Border Gateway Protocol (BGP) uses a complex, hierarchical list of attributes to select the "Best Path." BGP is a path-vector protocol designed for policy enforcement, not just shortest-path calculation.
In a global network architecture, BGP acts as the "Post Office" of the internet. It doesn't care about the fastest route in terms of milliseconds; it cares about the most reliable, compliant, and cost-effective route as defined by the network administrators.
The Selection Algorithm Hierarchy
When a BGP router receives multiple routes to the same prefix, it applies the following tie-breaking rules in order. The first rule that produces a single winner stops the process. This deterministic nature ensures that every router in an AS (ideally) makes the same decision, preventing routing loops.
The Decision List
- 1. Weight (Cisco Proprietary):
The highest weight is preferred. This value is local to the router and is never transmitted to neighbors. It is the "ultimate override" for a single box.
- 2. Local Preference:
Highest local preference (default 100) is preferred. Unlike Weight, this is shared with all iBGP peers within your AS. It is the primary tool for Outbound Traffic Engineering.
- 3. Locally Originated:
Prefer routes originated by this router using the
networkoraggregatecommands over those learned via BGP. - 4. AS-Path Length:
The shortest list of Autonomous Systems is preferred. This is the "Shortest Path" metric of BGP.
The Tie Breakers
- 5. Origin Type:
Prefer IGP (learned via interior protocol) over EGP, and EGP over Incomplete (redistributed).
- 6. Multi-Exit Discriminator (MED):
Lowest MED is preferred. This is used for Inbound Traffic Engineering to tell neighbors which entry point you prefer they use.
- 7. Neighbor Type:
Prefer eBGP paths over iBGP paths. This promotes traffic leaving the AS as quickly as possible (Hot Potato Routing).
- 8. IGP Metric to Next Hop:
The final tie-breaker: prefer the path with the lowest interior metric (OSPF/ISIS cost) to reach the BGP gateway.
BGP at the Industrial Edge: The Power Grid Backbone
In critical infrastructure (UTILITIES/GRID), BGP is often used to manage the connectivity of substations. Unlike typical IT environments, these locations rely on "Deterministic Failover." If a primary fiber link to a high-voltage transformer station is lost, the BGP path selection must reconverge onto a secondary microwave or LTE link without dropping the SCADA (Supervisory Control and Data Acquisition) session.
CMRP professionals focus on the **AVAILABILITY** component of the OEE (Overall Equipment Effectiveness) metric. In this context, BGP is not just a protocol; it is a reliability engine. A poorly tuned BGP timer can lead to 180 seconds of "black hole" traffic during a path switch, which is unacceptable for power grid stability monitoring.
Maintenance Strategy: The BGP Change Management
From a Facility Manager's (CFM) perspective, the networking backbone is as vital as the HVAC or Power distribution. When upgrading a core router, the "Standard Operating Procedure" (SOP) involves manipulating BGP attributes to gracefully drain traffic before the hardware is touched.
By increasing the MED or decreasing the Local Preference on a router slated for maintenance, you "push" traffic toward redundant nodes. This is equivalent to "Lock-Out Tag-Out" (LOTO) in electrical maintenance—you are ensuring the path is clear and isolated before performing the work.
Mathematical Influence: AS-Path Prepending
Network engineers often use "AS-Path Prepending" to discourage inbound traffic from choosing a specific link. By artificially inflating the AS-Path length, the path becomes less attractive to the selection algorithm.
Where is the number of times the local AS number is repeated in the path attribute. This is the primary mechanism for controlling ingress traffic when you have multiple ISP connections and want to keep one as a standby.
Conclusion: The Architecture of Trust
BGP is the glue that holds the internet together. While its decision-making algorithm may seem archaic compared to modern AI-driven routing, its predictability and policy-first approach are what make global horizontal scaling possible. Whether you are managing a global CDN or a localized industrial SCADA network, mastering BGP path selection is the hallmark of a Senior Network Architect.