Cisco Tips & Tricks

May 9, 2006

OSPF Cost

Filed under: IP Routing, ospf — ciscotips @ 9:38 pm

CISCO uses the formula 108/Bandwidth (of an interface) to calculate the interface cost. This produces the following costs for the interfaces :

Interface Type Bandwidth Cost

T3

45,045,00 2
Ethernet 10,000,000 10
Fast Ethernet 100,000,000 1

This formula is usable for interface speeds up to 100Mb, but with the introduction of high speed SONET and ATM interfaces in the network, this approach is not adequate. The following example will illustrate the problem.

Using a OC-3 interface, the bandwidth for this interface is 155,000,000. Using the formula 108/155,000,000 = 0.645. OSPF will round all decimals to 1, making it equal to the cost of a fast Ethernet interface. The same would hold true for OC-12, OC-48, and Gigabit Ethernet interfaces. Obviously, this would cause routing problems within the network. having interfaces with different bandwidths having the same cost.

CISCO provides a solution within certain router IOS software to be able to control how OSPF calculates the default metrics for an interface. This feature is enabled under the router ospf process using the ospf auto-cost reference-bandwidth ref-bw. Where ref-bw is the rate in megabits per second (bandwidth). The range is 1 to 4294967; the default is 100. The formula is now changed to be Reference-bandwidth/interface bandwidth. This feature allows us to globally change how the costs are determined by interface speed. This command was introduced in CISCO IOS release 11.2.

Conclusion:- If you are using OC-3 and higher links, you should enable ospf auto-cost reference-bandwidth under your router ospf process. Depending on your organizations routing policies you can implement different methods. The best practice here is specifying ip ospf cost manually for every interface. This is a best method to avoid confusion in route selection.

9 Comments »

  1. If you are going to move to a model where you enter static cost statements for each interface, rather than relying on b/w statements (overall a good thing), you should develop a standard policy for your entire network.

    Define a specific cost for each bandwith value you may have/need and use that consistently throughout your network.

    Note: OSPF Cost = 2×10^9/

    : Example
    256k – 2500
    512k – 2000
    768k – 1500
    1536k – 1000
    2048k – 750
    4092k – 500
    10/100mbps – 250
    Gig – 100

    Comment by Mike — May 9, 2006 @ 9:55 pm

  2. how do we calculate the cost and check it out with a command that will help us verify

    Comment by noel — August 4, 2007 @ 9:54 pm

  3. Hello Mike,

    Can you please elaborate how did you calculated the costs in the above given examples.

    Comment by Satty — October 16, 2007 @ 8:17 pm

  4. under the ospf process
    use auto-cost reference-bandwidth
    then modify the bandwidth on the interface.

    Comment by knoob — March 26, 2008 @ 7:31 pm

  5. How we can define bandwidth on Sub-interface of Router ATM?

    Comment by Ruchi — March 28, 2010 @ 3:43 pm

  6. Cost = Ref Bandwidth/interface bandwidth

    Comment by joseph Reeves — April 21, 2011 @ 3:19 pm

  7. Why it’s used just the out interface to calculate the cost?

    Comment by Johana — January 30, 2012 @ 9:00 pm

  8. It really is incredible to me that a lot of corporations are not making use of business ethernet.
    It’s so a great deal more cost-effective than T1 lines or bonded T1 lines. In case you have even bigger circuits like DS3 or OCx, Ethernet results in being substantially more economical.

    Comment by 10mb ethernet — December 5, 2012 @ 6:47 am

  9. very nice

    Comment by دانلود فیلم با لینک مستقیم — November 27, 2014 @ 10:44 pm


RSS feed for comments on this post. TrackBack URI

Leave a comment

Create a free website or blog at WordPress.com.