You want to change the OSPF link costs.
The auto-cost reference-bandwidth command allows you to change the reference bandwidth that OSPF uses to calculate its metrics:
Router5#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router5(config)#router ospf 87 Router5(config-router)#auto-cost reference-bandwidth 1000 Router5(config-router)#exit Router5(config)#end Router5#
You can also adjust the OSPF cost of a single interface with the ip ospf cost configuration command:
Router5#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router5(config)#interface Ethernet0 Router5(config-if)#ip ospf cost 31 Router5(config-if)# exit Router5(config)#end Router5#
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 of your core links.
It is important to set the same reference bandwidth on all routers in an area, and preferably throughout the entire network. Recall that OSPF allows every router to calculate its own routing table based on the LSAs that they receive. So they must all agree on the relationship between costs and bandwidth. Suppose you set the reference bandwidth differently on two routers, so that they advertise different link costs for their Ethernet interfaces. This could cause seriously strange routing patterns as OSPF will try to avoid using the higher cost links. It may decide, for example, that a FastEthernet interface on one router is faster than a Gigabit Ethernet interface on the other router.
But there is another interesting problem with the way OSPF calculates its metrics. The problem is the OSPF metric is only 16 bits long, giving it a maximum per-link cost value of 65,535. So, if your fastest links use 10 Gbps Ethernet, and you set the cost of this link to 1, then a relatively common 56 kbps serial link would need to have a cost of 178,571, and a 128 kbps circuit would cost 78,125. Since this is not possible, OSPF would use the maximum link cost of 65,535 for both of these low-speed links. This could cause some very poor routing patterns.
We suggest using an alternate costing strategy to avoid this problem. The idea is that the cost of a link doesn't actually have to be 10 times as high just because the link is 1/10 as fast. In fact, this default behavior implies that it is better to go through a succession of 10 FastEthernet links rather than use a single Ethernet, which is probably not true in most cases. So a useful alternative strategy is to use the square root of the bandwidth instead of the bandwidth when calculating the link cost. The result of this strategy is shown in Table 8-2.
|Medium||Nominal bandwidth||Default cost||Changing reference bandwidth||Cost with 1/square root model|
|9.6 kbps line||9.6 kbps||10,416||1,041,666||1,020|
|56 kbps line||56 kbps||1,785||178,571||422|
|64 kbps line||64 kbps||1,562||156,250||395|
|T1 circuit||1.544 Mbps||64||6,476||80|
|E1 circuit||2.048 Mbps||48||4,882||69|
|T3 circuit||45 Mbps||2||222||14|
|Fast Ethernet||100 Mbps||1||100||10|
|Gigabit Ethernet||1 Gbps||1||10||3|
|10 Gigabit Ethernet||10 Gbps||1||1||1|
|4 Mbps Token Ring||4 Mbps||25||2,500||50|
|16 Mbps Token Ring||16 Mbps||6||625||25|
As you can see in Table 8-2, if you use the default costs, then the three fastest links all wind up with a cost of 1. Changing the reference bandwidth to 10Gbps, however, produces impossibly large metrics for the three slowest links (the router will assign them all a link cost of 65,535). So no matter what reference bandwidth you use, if you retain the default 1/bandwidth cost mode, you will need to manually adjust either the fastest or slowest several link costs.
The second example shows how to change the OSPF cost for a single interface:
Router5(config)#interface Ethernet0 Router5(config-if)#ip ospf cost 31
You could also achieve a similar effect by just adjusting the bandwidth statements on each interface. However, this will have other consequences as well. It will affect any other routing protocols that you might also be running. And it will mean that an SNMP query of the interface speed will give an incorrect value, which could confuse network management software. We recommend the direct approach of manually setting the OSPF cost because what you are doing and why is more clear, in case somebody else comes along and wants to change the router configuration.
Router Configuration and File Management
User Access and Privilege Levels
Handling Queuing and Congestion
Tunnels and VPNs
NTP and Time
Router Interfaces and Media
Simple Network Management Protocol
First Hop Redundancy Protocols
Appendix 1. External Software Packages
Appendix 2. IP Precedence, TOS, and DSCP Classifications