OSPF cost calculation pitfall with high bandwidth interfaces
Cisco is using the (Reference bandwidth/interface Bandwidth) formula to calculate OSPF cost values of different interfaces; where the reference bandwidth is 10^8 by default.
Using this given formula the cost of FastEthernet links would be 1 and the cost of Ethernet links is 10.
This default reference bandwidth value is only suitable for links with bandwidth value less than or equal to 100Mbit.However interfaces with higher bandwidth values will have cost values of less than 1.
This leads to routing problems because OSPF will assign all interfaces with bandwidth above 100Mbit the same cost of 1 (OSPF is rounding up all fractions to 1).
Cisco provides a solution for this problem by allowing the change of the Reference bandwidth using the command auto-cost reference-bandwidth to an appropriate value.
In the following example we are changing the reference bandwidth value from 100 to 1000 before installing GigaEthernet interface in one of our routers in order to avoid the problems that may arise by OSPF giving the same cost to GigaEthernet and FastEthernet interfaces.
!-- Before changing the Reference value FastEthernet Cost is 1
R2(config-router)#do sh ip ospf int b R2(config-router)#auto-cost reference-bandwidth 1000 !-- After changing the refernce bandwidth value to 1000, GigaEthernet cost will be 1 and FastEthernet Cost is 10 R2(config-router)#do sh ip ospf int b |