Interface costs are part of the the shortest path first calculation that OSPF performs – the metric that helps OSPF decide what route to take is based on how much it will cost to reach the destination. OSPF can assign a dynamic interface cost based on a formula with a reference bandwidth of 100Mbps.
Cost = Reference Bandwidth / Interface Bandwidth
| Interface Type | OSPF Cost |
| T1 | 64 |
| Ethernet | 10 |
| FastEthernet | 1 |
| GigabitEthernet | 1 |
| 10 GigabitEthernet | 1 |
As the reference bandwidth is quite low at 100Mbps, speeds above 100Mbps are not distinguishable to OSPF as faster routes. The reference bandwidth can be modified to a higher value using the command auto-cost reference-bandwidth in the router process configuration mode. It is best practice that a consistent reference bandwidth is configured on all OSPF routers. The LSA metric field has a 16-bit limitation, a meaning a maximum cost of 65,535, setting the reference-bandwidth too high may result in low bandwidth interfaces being indistinguishable due to it hitting the metric max value.
If a manual cost is preferred to be set, it can be done with the command ip ospf cost in the interface configuration mode.

Leave a Reply