Connectivity and network design
How does BGP select the best path among competing routes?
BGP does not use one universal shortest-path rule: it applies local policy and preference, rejects ineligible routes, and then breaks remaining ties with path attributes and router or peer identifiers.
Common implementations consider LOCAL_PREF, local origination, AS_PATH length, ORIGIN, MED where comparable, eBGP versus iBGP, the IGP cost to the next hop, and final identifier-based tie breakers. The exact sequence includes implementation- and policy-specific behavior, so the router's documented decision process is authoritative for an operational network.
What is confirmed
- RFC 4271 separates route selection into phases: calculate preference, select eligible best routes, and disseminate selected routes.
- A route with an unresolvable NEXT_HOP is not eligible for selection, even if its other attributes appear preferable.
- LOCAL_PREF is propagated within an autonomous system and higher values are generally preferred; MED is intended to discriminate among multiple entry points from the same neighboring autonomous system.
- Vendor-specific attributes such as Cisco weight and locally configured policy can act before standards-based tie breakers.
The key concepts
Operator-defined import policy that accepts, rejects, or changes the preference of learned routes before final selection.
Expressing business relationships, traffic-engineering intent, security controls, and routing policy
A policy change can override the path that looks shortest and may behave differently across vendors.
Properties carried with a BGP route, including AS_PATH, ORIGIN, NEXT_HOP, MED, and LOCAL_PREF where applicable.
Comparing reachability learned from multiple peers or multiple paths
Not every attribute is comparable in every situation, and some are local to one autonomous system.
Deterministic comparisons used after higher-priority policy and preference decisions leave multiple eligible candidates.
Selecting one stable route for the routing table and advertisement
The final ordering and vendor extensions must be confirmed for the exact router software.
Practical guidance
For a real route, inspect every candidate with the router's BGP detail command, record policy changes and key attributes, verify NEXT_HOP reachability, and walk the documented decision order from the first difference instead of assuming the shortest AS_PATH wins.
Limits and verification boundary
RFC 4271 defines the protocol decision framework, but operator policy and implementation-specific attributes or ordering affect the result. Confirm the exact software release documentation before changing production routing policy.
Trusted telecom references
Use these original standards and public resources to verify details. References are related by topic, not claim-level citations.
- RFC 4271: Border Gateway Protocol 4IETF / RFC Editor · RFC 4271 defines BGP-4, the inter-autonomous-system routing protocol used to exchange reachability information across the Internet.
- RFC EditorIETF / RFC Editor · The RFC Series contains technical specifications and informational documents defining Internet protocols, routing, transport, security, and operations.
High confidence · Reviewed August 28, 2026 · Verify current commercial, regulatory, and safety-sensitive details with the applicable primary authority.