Friday, July 4, 2008

OSPF - Cost

OSPF Cost = Reference Bandwidth / Interface Bandwidth

The default reference bandwidth is 100Mbps, so for instance the OSPF cost for a T1 serial line is:

OSPF Cost 

= 100,000,000 / 1,544,000

= 64.7 (remove decimal)

~ 64

For loopback address, the cost is 1 because:


= 100,000,000 / 8,000,000,000

= 0.125 

~ round off to 1

If you want to override the formulated cost, you can use the interface command:

ip ospf cost <cost>

Let's see this example:

R1 is directed connected to R2 with a T1 serial link. R1 has its network advertised to R2 and from R2 we can see that the metric (cost) is 65. is on R1 loopback interface.


So loopback0 metric (1) + serial1/0 metric (64) = 65 on R2

Let's change R1 loopback0 cost so the configured value will override the formulated value:


Go back to R2 and see the output of show ip route:


The metric becomes 84 because:

loopback0 metric (20) + serial1/0 metric (64) = 84

Another way to influence the cost is changing the reference-bandwidth from default 100Mbps to some other numbers.

auto-cost reference-bandwidth <bandwidth in Mbps>


Let's change the reference bandwidth to 1000Mbps. Make sure you do it across all network.


No comments: