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:

OSPF Cost


= 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 1.0.0.0/8 advertised to R2 and from R2 we can see that the metric (cost) is 65. 1.0.0.0/8 is on R1 loopback interface.

image

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:

image

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

image

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>

image

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

image

No comments: