OSPF: auto-cost reference-bandwidth

Reference: Routing TCP/IP volume 1 page 345

Cost calculation for OSPF:


This works well with 100mpbs link whereby the cost is 1.

however if it exceeds the 100mbps boundary the cost calculation will still be 1, because decimal/fraction of 1 is unacceptable in ospf cost metric.

hence any fraction of 1 will be rounded back to 1.

this will cause the faster link (1gbps) to be the same cost with other 100mbps link making the routing decision to be hop-based instead of cost base.

to resolve this issue, cisco routers have this feature: auto-cost reference-bandwidth

Let’s look at this request:

A company will be upgrading its network links to gigabit, assuming the highest link is a 1gbps, you must configure the routers to accurately calculate the cost metric so that the gigabit is taken into account.

The command must be consistent throughout the ospf speaking routers.

WARNING: setting a reference bandwidth too high will cause some lower bandwidth links to lost ospf adjacency, ospf does have a cap to the cost calculation if the cost calculation exceeded the highest cap ospf will deem that route dead.

R5(config-router)#auto-cost reference-bandwidth ?
<1-4294967>  The reference bandwidth in terms of Mbits per second


R5(config-router)#auto-cost reference-bandwidth 1000
% OSPF: Reference bandwidth is changed.
Please ensure reference bandwidth is consistent across all routers.

R2(config)#router ospf 1
R2(config-router)#auto-cost reference-bandwidth 1000

R3(config)#router ospf 1
R3(config-router)#auto-cost reference-bandwidth 1000

R4(config)#router ospf 1
R4(config-router)#auto-cost reference-bandwidth 1000

R1(config)#router ospf 1
R1(config-router)#auto-cost reference-bandwidth 1000

Testing the effect:

R1#sh ip route ospf is variably subnetted, 5 subnets, 2 masks
O is a summary, 00:21:40, Null0 is subnetted, 3 subnets
O IA [110/2010] via, 00:00:20, FastEthernet0/0
O IA [110/2010] via, 00:00:20, FastEthernet0/0 is subnetted, 2 subnets
O IA [110/2011] via, 00:00:20, FastEthernet0/0
O IA [110/2011] via, 00:00:20, FastEthernet0/0

The cost metric actually increased 10 folds. The reference is 1gbps instead of 100mbps. Hence caution is needed to never set the reference bandwidth values into insane values.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s