Best-Path Selection · Lesson 01 of 02
Why one path wins
When BGP has several paths to a prefix, a fixed ordered list decides. Memorise the order and best-path stops being mysterious.
Written lesson
The precondition and the list
First, the NEXT_HOP must be reachable — an unreachable next hop removes a path from contention entirely. Then BGP walks the tie-breakers in order and stops at the first that decides: Weight (highest, Cisco-local) → Local Preference (highest, AS-wide) → locally originated (network/aggregate over received) → shortest AS_PATH → lowest ORIGIN (IGP < EGP < incomplete) → lowest MED → eBGP over iBGP → lowest IGP metric to the next hop → then the tie-breakers: oldest eBGP route, lowest router-ID, lowest cluster-list length, lowest neighbour address.
show bgp ipv4 unicast 192.0.2.0/24
show bgp ipv4 unicast 192.0.2.0/24 bestpath-reasonWritten lesson
Where policy plugs in
The first four steps are where almost all deliberate engineering happens. WEIGHT influences only the local router's own choice. LOCAL_PREF is the standard tool for choosing your AS's exit for a destination — set it inbound and it steers outbound traffic. AS_PATH prepend is how you make one of your own prefixes less attractive from outside, steering inbound traffic. MED is a softer, non-transitive hint to a single neighbour. Everything below MED is usually a tie-breaker you observe rather than set.
Inbound vs outbound
You control your OUTBOUND traffic by influencing your own best-path (WEIGHT, LOCAL_PREF). You influence your INBOUND traffic by changing what neighbours see (AS_PATH prepend, MED, communities) — and even then only influence, never command.