HomeNetworking › OSPF Cost

OSPF Cost Calculator

Cost is reference bandwidth divided by interface bandwidth, rounded down, never below 1. The interesting part is what that does to modern link speeds.

Local toolYour network plan stays in your browser. Nothing you enter is uploaded, logged, or sent to any server.

Common speeds at this reference

Why the default reference bandwidth is a problem

OSPF cost is reference ÷ bandwidth, rounded down to an integer, with a floor of 1. The reference has defaulted to 100 Mbit/s since OSPF was specified, and on most platforms it still does.

Everything at or above the reference gets cost 1. A 100 Mbit/s link, a gigabit link and a 100-gigabit link are all cost 1, so OSPF cannot tell them apart. A path over three 100 Mbit/s links costs 3; a single 100-gigabit link costs 1 — but so does a single 100 Mbit/s link, and traffic will happily take it over a faster alternative with one more hop.

Raise the reference everywhere or nowhere. The setting is per-router. If one router uses 100 Mbit/s and its neighbour uses 100 Gbit/s, they compute different costs for the same links and choose different paths in each direction. Asymmetric routing follows, and so do the problems that come with it. Changing it is a coordinated change across the whole OSPF domain, which is exactly why so many networks never did.

Cost can also be set directly on an interface, which overrides the calculation entirely and is often the more predictable choice for links you care about.

Related tools

OSPF Area Designer checks a whole topology. BGP Best-Path Simulator covers the other protocol.