Command
IP OSPF Cost
Use
This command is used to manually set the OSPF link cost. This is typically done for traffic engineering purposes to modify what link OSPF will prefer. Lower is better.
Syntax
Router(config-if)#ip ospf cost <cost>
Example
In this example, we will use cost to make R1 prefer the frame-relay link to get to R3.
Currently OSPF prefers the fa0/0 link with a cost of 3
R1(config-if)#do show ip route ospf | in 33. |
Using the ip ospf cost command we set the Fa0/0 cost so that it is higher then any other link. R1 now prefers the S1/1 link with a cost of 65.
R1(config-if)#int fa0/0 R1(config-if)#do show ip route ospf | in 33. |
Again, we change the cost of the S1/1 link so that it is higher then the frame-relay link S1/0. Now R1 is prefering the s1/0 link to reach R3. If S1/0 goes down it will prefer the s1/1 link with a cost of 150.
If that goes down it will use the fa0/0 link with a cost of 200.
R1(config-if)#int s1/1 R1(config-if)#do show ip route ospf |