Cost
Cheat sheet · https://pcornel.dk/topic.php?topic=632
Answer
OSPF cost is the metric per interface; a route's cost is the sum along the path, and the lowest total wins. By default cost = reference bandwidth / interface bandwidth, with a reference of 100 Mbps.
Remember
With the default reference, every link of 100 Mbps or faster costs 1 — 1 Gbit/s and 100 Gbit/s look the same. Set auto-cost reference-bandwidth (in Mbps) to the same value on every router, or set ip ospf cost deliberately. Cost is counted on the outgoing interface.
First checks
show ip ospf interface brief— cost per interface.show ip route <prefix>— total cost in brackets[110/cost].show ip ospf | include Reference— reference bandwidth.show running-config | include auto-cost|ip ospf cost— what is configured.
Commands
ip ospf cost <cost>- Set the OSPF cost of the interface, overriding the bandwidth-based value.
auto-cost reference-bandwidth <mbps>- Set the OSPF reference bandwidth used to calculate interface cost; set the same value on all routers.
ip ospf costshow ip ospf interfaceshow ip route ospf
Verify in this order
reference bandwidth the same on all routers → interface costs reflect speed or intent → SPF sums cost along each path → lowest total installed → equal totals shared
Where it usually breaks
underlay/interface reachability → protocol adjacency/session → received/originated state → policy → best path/RIB → FIB/adjacency → traffic path
Cost · operational reference
| Metric concept | Meaning |
|---|---|
| Interface cost | Local outgoing OSPF metric |
| Reference bandwidth | Scale used for derived cost |
| Accumulated cost | Sum used by SPF to compare paths |
| Equal cost | Can permit ECMP |
| Low OSPF cost | Does not mean low latency/utilization |
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=632