Adjusting OSPF Costs
Problem
You want to change the OSPF link costs.
Solution
The auto-cost reference-bandwidth command allows you to change the reference bandwidth that OSPF uses to calculate its metrics:
Router5#configure terminalEnter configuration commands, one per line. End with CNTL/Z. Router5(config)#router ospfRouter5(config-router)#87auto-cost reference-bandwidthRouter5(config-router)#1000exitRouter5(config)#endRouter5#
You can also adjust the OSPF cost of a single interface with the ip ospf cost configuration command:
Router5#configure terminalEnter configuration commands, one per line. End with CNTL/Z. Router5(config)#interfaceRouter5(config-if)#Ethernet0ip ospf costRouter5(config-if)#31exitRouter5(config)#endRouter5#
Discussion
The custom in OSPF networks is to make the link cost inversely proportional to the bandwidth of a link. This isn’t required, but it is common, and it is the default behavior for Cisco routers. The reference bandwidth defines the link speed that has an OSPF cost of 1. By default, the reference bandwidth is 100 Mbps.
However, if you have faster links in your network, such as gigabit Ethernet or OC-3 connections, OSPF can’t give these links a better cost than 1. So you should set the reference bandwidth to at least as high as the fastest link in your network. In fact, you may want to set this value higher than the bandwidth of your fastest link to ensure that you don’t have to reconfigure your whole network when you eventually upgrade some ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access