OSPF Cost Calculation
OSPF uses a metric called "cost" to determine the best path to a destination. The cost is inversely proportional to the bandwidth of the interface.
Formula:
Cost = Reference Bandwidth / Interface Bandwidth
- Default Reference Bandwidth: 100 Mbps (10^8 bps)
- Example: FastEthernet (100 Mbps) Cost = 10^8 / 10^8 = 1
- Example: GigabitEthernet (1000 Mbps) Cost = 10^8 / 10^9 = 0.1 (rounded up to 1)
Adjusting Reference Bandwidth:
For faster links (e.g., GigabitEthernet, TenGigabitEthernet), the default reference bandwidth might cause all links to have a cost of 1. To ensure proper path selection, the reference bandwidth should be increased.
router ospf 1
auto-cost reference-bandwidth 10000
- The value is in Mbps.
10000
means 10 Gbps.