OSPF Metric: Understanding Cost in CCNA
OSPF uses 'cost' as its metric, calculated by dividing a reference bandwidth (default 100 Mbps) by the interface's actual bandwidth.
The OSPF Cost Formula
By default, OSPF cost is calculated as 10^8 (100 Mbps) / Interface Bandwidth in bps. Lower cost indicates a faster, preferred path.
The Reference Bandwidth Problem
Because the default reference bandwidth is 100 Mbps, OSPF treats FastEthernet, GigabitEthernet, and 10G links all with a cost of 1, unable to distinguish their speeds.
Adjusting the Cost
Use the 'auto-cost reference-bandwidth' command to change the reference bandwidth globally, or manually set an interface's cost using 'ip ospf cost'.
❓ Frequently Asked Questions
What happens if OSPF paths have equal cost?
OSPF will load balance across the paths automatically. This is known as Equal Cost Multi-Path (ECMP).
Do I need to change reference bandwidth on all routers?
Yes, it is best practice to configure the same reference bandwidth on all OSPF routers in the network to ensure consistent routing decisions.
What is the cost of a loopback interface?
By default, Cisco sets the OSPF cost of a loopback interface to 1.