BGP route selection design process on Junpiper routers
From The sin within
When a Juniper router has one or more BGP neighbors, the route/path selection process is:
- Step 1: Can the BGP next-hop be resolved ?
- Step 2: Prefer the path with the highest local preference value
- Step 3: Prefer the path with the shortest AS-path length
- Step 4: Prefer the path with the lowest origin value
- Step 5: Prefer the path with the lowest MED value
- Step 6: Prefer the path learned using EBGP over paths learned using IBGP
- Step 7: Prefer path with the lowest IGP metrics:
- a. Examine route table inet.0 and inet.3 for the BGP next-hop, and then install the physical next-hop(s) found in inet.3
- b. For preference ties, install the physial next-hop(s) found in inet.3
- c. For preference ties within the same route table, install the physical next-hop(s) where the greater number of equal-cost paths exists
- Step 8: Prefer paths with the shortest cluster length
- Step 9: Prefer routes from the peer with the lowest router ID (RID), unless multipath is enabled
- a. For external routes from different ASs, do not alter the active route based on the lowest RID to prevent MED oscillation
Step 10: Prefer routes from the peer with the lowest peer ID (BGP peering address), unless multipath is enabled

