Best Path
Cheat sheet · https://pcornel.dk/topic.php?topic=1136
Answer
BGP compares the valid paths for a prefix in a fixed order and stops at the first difference. Cisco order: highest Weight, highest LOCAL_PREF, locally originated, shortest AS_PATH, lowest ORIGIN (IGP < EGP < incomplete), lowest MED, eBGP over iBGP, lowest IGP metric to NEXT_HOP, then tie-breakers (oldest eBGP path, lowest router ID, shortest CLUSTER_LIST, lowest neighbour address).
Remember
The first differing attribute decides — a higher LOCAL_PREF beats any AS_PATH length, and MED is only compared between paths from the same neighbouring AS. A BGP best path can still lose the routing table to a route with lower administrative distance (RIB-failure).
First checks
show ip bgp <prefix> → all paths and the best marker. show ip route <prefix> and show ip bgp rib-failure → did it reach the RIB. show ip cef <prefix> → forwarding.
Commands
show ip route <next-hop>show ip bgp rib-failureshow ip routeshow ip cefshow ip bgp
Verify in this order
valid candidates (NEXT_HOP reachable, policy permits) → first differing attribute in decision order → best marker → RIB (no rib-failure) → CEF/next hop → traffic and return path
Where it usually breaks
underlay/interface reachability → protocol adjacency/session → received/originated state → policy → best path/RIB → FIB/adjacency → traffic path
Common Cisco BGP best-path order
| Order | Factor | Preferred | Scope / note |
|---|---|---|---|
| 1 | Weight | Higher | Cisco local router only |
| 2 | LOCAL_PREF | Higher | intra-AS policy |
| 3 | Locally originated | Local | common Cisco factor |
| 4 | AS_PATH | Shorter | after earlier factors |
| 5 | Origin | IGP, EGP, incomplete | lower origin code |
| 6 | MED | Lower | comparison rules/context matter |
| 7 | eBGP vs iBGP | eBGP | later factor |
| 8 | IGP metric to NEXT_HOP | Lower | recursive reachability required |
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=1136