Pcornel
Networking · Routing › OSPF › OSPF Fundamentals

Cost

Cheat sheet · https://pcornel.dk/topic.php?topic=1094

Back to the Topic

Answer

OSPF cost is the metric for each interface, added up along a path; the lowest total cost wins. On Cisco the default is reference bandwidth (100 Mbps) divided by interface bandwidth, so set auto-cost reference-bandwidth higher on networks faster than 100 Mbps.

Remember

Do not infer service health from one command. For Cost, distinguish configured intent, protocol/security state, installed forwarding state and the original workload result.

First checks

  • show ip ospf interface <interface> — Cost
  • show ip route ospf — total metric
  • show running-config | section router ospf — auto-cost reference-bandwidth

Commands

ip ospf cost <n>
show ip route <prefix>
show ip ospf interface brief
ip ospf cost

Verify in this order

interface bandwidth/ref → cost → SPF sums costs → best path

Where it usually breaks

underlay/interface reachability → protocol adjacency/session → received/originated state → policy → best path/RIB → FIB/adjacency → traffic path

Cost operational reference

BoundaryKnown-good for CostSuspicious signatureNext proof
IntentMatches the per-interface OSPF metric whose cumulative path value drives intra-domain shortest-path selection designConfiguration differs from design/peerCompare effective configuration
Control/security stateStable expected neighbor/database/binding/election stateasymmetric or unexpected path selection from inconsistent reference bandwidth, explicit cost left on one interface, equal costs where differentiation was intended, or metric tuning used to mask an adjacency/forwarding faultInspect protocol/security detail and adjacent state
ForwardingExpected Layer-2 or RIB/FIB/gateway pathControl state exists but traffic path disagreesMAC/ARP/RIB/FIB/CEF proof
ClosureOriginal test passes for explained reasonSymptom moved, was bypassed or protection disabledRegression test

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=1094

Confirmation

Confirm action

Continue?