OSPF Puzzle Part III - Costs

Quick to the point post today - I posed the question last post as to how to configure the costs on the interfaces in my example/puzzle. The only tricky part is this: did you figure out the four ways to change R4's cost on it's Fa0/0 interface to a value of 10? All using CCNA-level config?

Do you feel the suspense building? OK, this isn't a Hollywood thriller. I'm really doing this puzzle to get to the next post - and talk about LSA types again, as compared to the "show ip ospf database" command. But I want to be complete, plus, for those of you finishing up your CCNA study, the config in here is within scope of the CCNA exam. So, here's some options to get R4's Fa0/0 an OSPF cost of 10:


The easiest way to get the costs listed in the last post is to just configure the "ip ospf cost x" interface subcommand, eg, on R4, for what was labeled link number 5:

  • Interface Fa0/0
  •  Ip ospf cost 10


The second method is to set the OSPF reference bandwidth. If the "ip ospf cost" interface subcommand is not configured, then OSPF defaults the OSPF interface cost to Ref-BW / interface-BW, taking care to match the units. For example, on a serial link, interface bandwidth defaults to 1544, meaning 1544 Kilobits/second, or 1.544 Mbps. Then, you could pick an OSPF reference bandwidth, as defined with the "auto-cost reference-bandwidth x" command in OSPF router config mode, to set reference bandwidth. With the default of 100 Mbps, and default bandwidth, a serial interface's default OSPF cost is 100 / 1.544, or 64 (rounded down).

Method 2 in this post changes the reference bandwidth, and leaves Fa0/0's interface bandwidth at 100 Mbps.

Taking link 5 from the figure in the previous post - R4's Fa0/0 interface - with a goal of setting the cost to 10, you could configure R4 as follows:

  • Router ospf 1
  •  Auto-cost reference-bandwidth 1000

If you assume that R4's Fa0/0 has a bandwidth setting of 100,000 (ie, 100 Mbps), then R4 calculates a default cost of 1000 / 100 = 10.


The third configuration method leaves the reference bandwidth at it's default of 100 Mbps, and explicitly configures the interface bandwidth to 10,000 (10 Mbps). I'm not saying to make the link run at 10 Mbps, just set the bandwidth. For example, assuming the reference bandwidth has not been set to a non-default value:

  • Interface fa0/0
  •  Bandwidth 10000

The math then works out to 100 / 10  (100 Mbps Ref-BW over 10,000 Kbps, or 10 Mbps, interface bandwidth), or cost 10.


The last method leaves the reference bandwidth at it's 100 Mbps default, and changes the interface bandwidth to 10Mbps thought a small trick. I wouldn't recommend this in a production network as part of a design for OSPF costs, but it does work just for learning's sake.

On a router 10/100 interface, unless explicitly configured with the "bandwidth" interface subcommand, the interface bandwidth defaults to a value based on the actual link speed. If R4's Fa0/0 happened to auto-negotiate to use 10 Mbps, or to be explicitly configured to use 10 Mbps, AND the interface "bandwidth" command has not been configured, then the interface's bandwidth will be 10,000 kbps to match. With a default reference bandwidth of 100 Mbps, and a 10,000 Kbps (10 Mbps) interface bandwidth, the 100 / 10 calculation gives us a cost of 10. So, the config could be:

  • Interface fa0/0
  •  Speed 10

On to LSAs next...

Join the Network World communities on Facebook and LinkedIn to comment on topics that are top of mind.

Copyright © 2009 IDG Communications, Inc.