website pop up marketing ip ospf cost
Cisco CCNA | CCNP Certification Training Site. Cisco tips and tools for exam success. logo video

ip ospf cost

Printer-Friendly Format

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.
33.0.0.0/32 is subnetted, 1 subnets
O 33.33.33.33 [110/3] via 10.1.1.2, 00:00:09, FastEthernet0/0
133.133.0.0/32 is subnetted, 1 subnets
O 133.133.133.133 [110/3] via 10.1.1.2, 00:00:09, FastEthernet0/0


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)#ip ospf cost 200

R1(config-if)#do show ip route ospf | in 33.
33.0.0.0/32 is subnetted, 1 subnets
O 33.33.33.33 [110/65] via 192.168.13.2, 00:00:05, Serial1/1
133.133.0.0/32 is subnetted, 1 subnets
O 133.133.133.133 [110/65] via 192.168.13.2, 00:00:05, Serial1/1


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)#ip ospf cost 150

R1(config-if)#do show ip route ospf
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/130] via 10.4.4.4, 00:00:01, Serial1/0
33.0.0.0/32 is subnetted, 1 subnets
O 33.33.33.33 [110/129] via 10.4.4.4, 00:00:01, Serial1/0

3.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/129] via 10.4.4.4, 00:00:01, Serial1/0
4.0.0.0/32 is subnetted, 1 subnets
O 4.5.5.5 [110/65] via 10.4.4.4, 00:00:01, Serial1/0
10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
O 10.4.4.3/32 [110/128] via 10.4.4.4, 00:00:01, Serial1/0
O 10.2.2.0/24 [110/129] via 10.4.4.4, 00:00:01, Serial1/0
O 10.4.4.4/32 [110/64] via 10.4.4.4, 00:00:01, Serial1/0
133.133.0.0/32 is subnetted, 1 subnets
O 133.133.133.133 [110/129] via 10.4.4.4, 00:00:01, Serial1/0



Back to commands department




Printer-Friendly Format

This site and/or material is not sponsored by, endorsed by, or affiliated with Cisco Systems, Inc. and/or its affiliates. Cisco®, Cisco Systems®, CCDA™, CCNA™, CCDP™, CCNP™, CCIE™, or CCSI™ are trademarks or registered trademarks of Cisco Systems, Inc. and/or its affiliates in the United States and certain other countries.

Home | Search | Contact Us | Tell a Friend | Text Size

2006-2013 HowtoNetwork.net All Rights Reserved. Reproduction without permission prohibited.
Reality Press, Midsummer Court, 314 Midsummer Blvd.,Milton Keynes, MK92UB, UK

This site is powered by MemberGate Membership Site Software