OSPF Cost Bandwidth Calculator
Computes OSPF interface cost using the 100 Mbps reference divided by link bandwidth.
โ
OSPF Cost Formula & Reference Bandwidth
The Open Shortest Path First protocol (OSPFv2 for IPv4, OSPFv3 for IPv6) is a link-state IGP standardized in RFC 2328. Every interface gets a metric called cost, which comes from cost = reference_bandwidth / interface_bandwidth, rounded down and never less than 1. Routers flood Link-State Advertisements (LSAs) around, then run Dijkstra's SPF algorithm to work out a shortest-path tree to every prefix.
On Cisco IOS the default reference bandwidth is 100 Mbps. A 100 Mbps Fast Ethernet link costs 1, and here's the catch: so does a 1 Gbps or 10 Gbps link, because the protocol can't tell them apart. The fix in a modern datacenter is to raise the reference with auto-cost reference-bandwidth 100000 (100 Gbps), which puts 10 Gbps at cost 10 and 1 Gbps at cost 100. You have to set the same value on every router in the area, or the metrics stop lining up.
Applications
OSPF breaks large networks into areas joined by a backbone (area 0). The routers sitting on area boundaries are ABRs (Area Border Routers), and the ones redistributing external routes are ASBRs (Autonomous System Boundary Routers). In WAN design, cost tuning is how you make fiber win out over a microwave link, how you set up failover between a primary and backup circuit, and how you spread load across equal-cost multipath (ECMP) parallel paths.
FAQ
Why does 10 Gbps default to cost 1? The default reference bandwidth of 100 Mbps caps any link ≥ 100 Mbps at cost 1. The formula rounds down and won't go below 1, so everything that fast lands on the floor.
Can I set cost manually? You can. Putting ip ospf cost <n> on the interface overrides whatever the formula computed, which comes in handy when you want path selection driven by policy.
What is the difference between OSPFv2 and OSPFv3? OSPFv3 (RFC 5340) handles IPv6 natively, no longer ties adjacency to the IP subnet, and operates per-link rather than per-subnet. The cost formula stays exactly the same.
Related Tools
Rent Adjustment Calculator
Compute annual rent adjustment by IGP-M or IPCA accumulated in the last 12 months (manually configurable).
Pregnancy Calculator
Compute estimated due date (EDD), gestational age and trimester from the last menstrual period (LMP).
Fertile Period Calculator
Compute fertile window and ovulation day from the first day of the last cycle and the average cycle length.