Friday, November 4, 2016

OSPF - Auto Cost Reference Bandwidth feature in Cisco IOS


In the case of OSPF, the OSPF metric – Cost is inversely proportional to interface bandwidth.

Meaning, the higher bandwidth link on your device will have lower cost.

But OSPF by default is unable to differentiate the cost properly for a device that has both TenG and Gig interfaces.

The reason why OSPF is unable to do so is because default reference bandwidth is 100 Mbps

And the formula used is
Interface Cost = Reference Bandwidth in Mbps / Interface Bandwidth

So for a TenG interface, since the default reference bandwidth is 100 Mbps and cost values range from 1 – 4294967, cost of a TenG will be 1.
Cost cannot go lower than 1

Cost of a Gig interface will be 1 as well.

The result of this can be illustrated in example below.

The Problem:

In figure above, PC is connected on LAN interface of router A.
Traffic from PC is destined towards the server shown in figure above.
Consider that the link between A and B is congested during production hours.
There is a high capacity TenG link between A and C.
OSPF is being used as IGP here.
From the perspective of router A, the default OSPF auto cost reference bandwidth is being used.
Router A is doing Equal Cost Multi Path because cost of both the possible paths towards the server upstream is the same.
This traffic flow is undesired because we do not want any more traffic load on the already congested link between A and B.

Workaround:


OSPF Auto-Cost reference bandwidth on router A needs to be modified so TenG interface of router A has a lower cost than its Gig interface.
As depicted in figure below, the reference bandwidth is raised to 10000

Once the reference bandwidth on router A is raised, router A knows that is has better interface connected towards router C.
Cost of the link between router A and C is 1 and the cost of link between router A and B is 10.
Traffic sourced from the PC destined to the server is now shifted towards the link between router A and C.

This feature of Cisco IOS comes handy when you have got a Layer 3 device in your data center that is aggregating Gig, TenG, 40G links.


 Another alternative solution would be to explicitly configure OSPF cost values under the interface.