OSPFCCNA 200-301

OSPF Choosing Suboptimal Path Due to Cost Misconfiguration

Presenting Symptom

Traffic from R1 to a destination behind R3 takes a suboptimal path via R2 instead of the direct link to R3.

Network Context

Three routers (R1, R2, R3) are connected in a triangle topology: R1 to R2 (GigabitEthernet0/0, 10.0.12.0/24), R1 to R3 (GigabitEthernet0/1, 10.0.13.0/24), and R2 to R3 (GigabitEthernet0/0, 10.0.23.0/24). All routers run OSPF in area 0. The link between R1 and R3 is a high-speed GigabitEthernet link, but the OSPF cost on that interface has been misconfigured to a high value.

Diagnostic Steps

1

Check the OSPF routing table on R1

show ip route ospf
O    10.0.23.0/24 [110/2] via 10.0.12.2, 00:00:10, GigabitEthernet0/0
O E2 192.168.3.0/24 [110/20] via 10.0.12.2, 00:00:10, GigabitEthernet0/0

The route to 192.168.3.0/24 (behind R3) is learned via R2 (10.0.12.2) instead of the direct path via R3 (10.0.13.3). This indicates a suboptimal path.

2

Examine OSPF neighbors on R1

show ip ospf neighbor
Neighbor ID     Pri   State           Dead Time   Address         Interface
10.0.23.3         1   FULL/DR         00:00:35    10.0.13.3       GigabitEthernet0/1
10.0.12.2         1   FULL/DR         00:00:38    10.0.12.2       GigabitEthernet0/0

Both neighbors are FULL, so adjacency is not the issue. The problem is likely cost-related.

3

Check OSPF interface cost on R1's links

show ip ospf interface gigabitEthernet 0/1
GigabitEthernet0/1 is up, line protocol is up
  Internet Address 10.0.13.1/24, Area 0
  Process ID 1, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 1000
  Transmit Delay is 1 sec, State DR, Priority 1

The cost on the GigabitEthernet0/1 interface is 1000, which is abnormally high for a Gigabit link (default cost is 1). This explains why OSPF prefers the path via R2.

4

Verify the default OSPF cost reference bandwidth

show ip ospf | include Reference bandwidth
Reference bandwidth unit is 100 mbps

The reference bandwidth is 100 Mbps. For a Gigabit interface (1000 Mbps), the default cost should be 100/1000 = 0.1, but OSPF uses integer costs, so it becomes 1. A cost of 1000 indicates a manual misconfiguration.

Root Cause

The OSPF cost on R1's GigabitEthernet0/1 interface (connected to R3) has been manually set to 1000 using the 'ip ospf cost 1000' command, overriding the default cost of 1. This causes OSPF to prefer the path via R2 (cost 2) over the direct link (cost 1000).

Resolution

Remove the manual cost configuration on R1's GigabitEthernet0/1 interface to restore the default cost. Commands: ``` R1(config)# interface gigabitEthernet 0/1 R1(config-if)# no ip ospf cost 1000 ``` This removes the manual cost, allowing OSPF to calculate the cost automatically based on bandwidth (default cost 1 for GigabitEthernet).

Verification

Run 'show ip route ospf' on R1 to confirm the route to 192.168.3.0/24 now points to 10.0.13.3. Expected output: ``` O 10.0.23.0/24 [110/2] via 10.0.13.3, 00:00:05, GigabitEthernet0/1 O E2 192.168.3.0/24 [110/1] via 10.0.13.3, 00:00:05, GigabitEthernet0/1 ``` The cost is now 1, and the next hop is R3 directly.

Prevention

["Avoid manually setting OSPF cost on interfaces unless absolutely necessary; rely on auto-cost reference bandwidth.","Use the 'auto-cost reference-bandwidth' command to adjust the reference bandwidth for high-speed links instead of manual cost.","Regularly audit OSPF interface costs using 'show ip ospf interface brief' to detect anomalies."]

CCNA Exam Relevance

On the CCNA 200-301 exam, this scenario may appear as a troubleshooting question where you must identify why OSPF is choosing a suboptimal path. The exam tests understanding of OSPF cost calculation, the 'ip ospf cost' command, and how manual configuration can override automatic cost. Key fact: OSPF cost is inversely proportional to bandwidth; default cost for GigabitEthernet is 1.

Exam Tips

1.

Remember that OSPF cost = reference bandwidth / interface bandwidth. Default reference bandwidth is 100 Mbps.

2.

If you see a high cost on a high-speed interface, suspect a manual 'ip ospf cost' configuration.

3.

Use 'show ip ospf interface' to quickly check the cost on an interface.

Commands Used in This Scenario

Test Your CCNA Knowledge

Practice with scenario-based questions to prepare for the CCNA 200-301 exam.

Practice CCNA Questions