Let’s start working on how to influence the OSPF path selection.
The formula for OSPF automatic cost calculation is the following:
Interface Cost = Reference Bandwidth / Interface Bandwidth
By default, the reference bandwidth is 100Mbps.
R1#sh ip ospf | s Reference Reference bandwidth unit is 100 mbps
So a 100Mbps Fast Ethernet interface have a cost of 1.
In recent network we often see faster interface speed but for any Gigabit or higher bandwidth interfaces the cost will still be 1.
Make sure that the OSPF cost for higher-bandwidth interfaces have separate (more granular) cost values
Configuration and verification:
From R4, we can see that even if there is a 10G link to R1, the OSPF cost is the same than for the 1G link to R2:
R4#sh ip ospf int Eth 0/0 | i Cost Process ID 10, Router ID 188.8.131.52, Network Type POINT_TO_POINT, Cost: 1 R4#sh int Eth 0/0 | i BW MTU 1500 bytes, BW 10000000 Kbit/sec, DLY 1000 usec, R4#sh ip ospf int Eth 0/1 | i Cost Process ID 10, Router ID 184.108.40.206, Network Type POINT_TO_POINT, Cost: 1 R4#sh int Eth 0/1 | i BW MTU 1500 bytes, BW 1000000 Kbit/sec, DLY 1000 usec,
The route to R3 loopback is then showing an equal cost through R1 or R2:
R4#sh ip route 220.127.116.11 Routing entry for 18.104.22.168/32 Known via "ospf 10", distance 110, metric 3, type inter area Last update from 10.10.24.1 on Ethernet0/1, 00:03:42 ago Routing Descriptor Blocks: 10.10.24.1, from 22.214.171.124, 00:03:42 ago, via Ethernet0/1 Route metric is 3, traffic share count is 1 * 10.10.14.1, from 126.96.36.199, 00:03:47 ago, via Ethernet0/0 Route metric is 3, traffic share count is 1
To make the OSPF cost values more granular, we can change the auto-cost reference bandwidth.
R4(config)#router ospf 10 R4(config-router)#auto-cost reference-bandwidth 10000 % OSPF: Reference bandwidth is changed. Please ensure reference bandwidth is consistent across all routers.
Now the OSPF cost to R1 is 1 and the OSPF cost to R2 is 10.
You can see the warning message, you better change the reference bandwidth on all your router otherwise you might create routing loops.
Because the cost to R3 loopback is now higher via R2, only the route via R1 is showing in the routing table.
R4#sh ip route 188.8.131.52 Routing entry for 184.108.40.206/32 Known via "ospf 10", distance 110, metric 3, type inter area Last update from 10.10.14.1 on Ethernet0/0, 00:09:26 ago Routing Descriptor Blocks: * 10.10.14.1, from 220.127.116.11, 00:09:31 ago, via Ethernet0/0 Route metric is 3, traffic share count is 1
So in today’s network, you better change the OSPF reference bandwidth at the start of the implementation to make sure that it takes into account high bandwidth interfaces.
Thank you for reading.
OSPF – Implement and troubleshoot path preference – Auto cost