Path Selection Process
This appendix explains the BGP path selection process and provides some additional detail about MED comparison based on parameter settings.
Best-Path Selection Algorithm
The BGP path decision process compares paths to the same destination prefix that are held in the Adj-RIB-In and defines a degree of preference for a path (or paths), which in turn is advertised to peers (subject to Adj-RIB-Out policy).
If the Next-Hop attribute of a BGP route is an address that is not reachable (resolvable), the route is not considered as part of the decision process. The process follows these steps:
1. Select the route from the hierarchy of routes learned from different protocols. In SR-OS this is indicated as preference, and the route learned through the protocol with the lowest preference value is considered the best. (Note that IBGP and EBGP both have a preference value of 170.)
2. Select the route with the highest Local Preference (LOCAL-PREF attribute).
3. Select the route with the least number of Autonomous Systems in its AS_PATH attribute (unless as-path-ignore is configured). An AS_SET counts as one AS.
4. Select the route with the lowest ORIGIN attribute (where IGP = 0, EGP =1, and incomplete = 2).
Select the route with the lowest MED value if one of the following applies:
i. Both routes have the MED attribute and were advertised by the same neighbor AS (leftmost AS in the AS_PATH).
ii. Both routes were advertised by a different neighbor AS but