How a Cisco router picks one best path — one fixed chain:
Longest Prefix Match → Administrative Distance → Metric → ECMP → FIB
- LPM beats everything. To 10.10.10.5, a /24 wins over a /16 no matter what AD or metric says.
- AD chooses between protocols at equal prefix length: connected 0, static 1, eBGP 20, EIGRP 90, OSPF 110, RIP 120, iBGP 200.
- Metric chooses inside one protocol — never compared across protocols.
- ECMP: equal prefix + AD + metric installs several paths; CEF balances per-destination by default.
Control plane builds the RIB; the data plane forwards from the FIB via CEF. A next-hop that isn’t directly connected triggers a recursive lookup before the route is installed.