Categories R&S

OSPF – Implement and troubleshoot path preference – Auto cost

Let’s start working on how to influence the OSPF path selection.

 

 

Theory:

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.

 

Requirements :

Make sure that the OSPF cost for higher-bandwidth interfaces have separate (more granular) cost values

 

Diagram:

OSPF - Implement and troubleshoot path preference - Auto cost

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 44.44.44.44, 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 44.44.44.44, 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 3.3.3.3
Routing entry for 3.3.3.3/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.22.22.22, 00:03:42 ago, via Ethernet0/1
      Route metric is 3, traffic share count is 1
  * 10.10.14.1, from 11.11.11.11, 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 3.3.3.3
Routing entry for 3.3.3.3/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 11.11.11.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