Monday, September 10, 2012

OSPF Metric Calculation

This post will go abit more into detail about the OSPF metric calculation and the different bandwidth commands that can be applied.

The basic idea behind OSPF metric calculation is adding outgoing interface costs from the source network to the destination network.  The SPF algorithm calculates this metric using the formula:

Reference Bandwidth  / Interface Bandwidth

This sounds easy enough, but a potential problem that can play into calculating the metric has to do with the  units used by the formula, and what units the router config command auto-cost reference <value> and the interface command bandwidth <value> use.  When the formula is applied by the SPF algorithm, IOS converts the units to use the same type- Mbps.

By default, an Ethernet interface will use the value 10,000 for its bandwidth.  This unit type is set in Kbps, in Mbps that would be converted to a value of 10.  The default reference bandwidth value is 100.  This value is set in Mbps.  So by default, an Ethernet cost will be calculated as 100/10 = 10

It is recommended to change the reference-bandwidth value when working with bandwidth speeds at or great then 100 Mbps, otherwise the cost for both a 1 Gbps interface, and a 100 Mbps interface would be the same : 1.

Alternatively, this formula can be overriden by manually setting the interface cost value within a range of 1-6535 by using the interface command ip ospf cost.  Do not confuse this command with ip ospf priority, this command is used to modify an interface's priority value to be used with a designated/backup designated router election.

To verify your configuration, you can use the command show ip ospf interface.  The output will list detailed information about the interface, along with the calculated cost.  This example shows the default bandwidth cost on a fast ethernet interface.


By default, the formula used was 100Mbps/100Mbps
Now we will modify the reference bandwidth value to use 1000 Mbps.



As you can see now, the formula was modified to 1000Mbps/100Mbps.

No comments:

Post a Comment