OSPF Cost Calculation on Exam — Common Mistakes
Presenting Symptom
A router in an OSPF network is not learning routes from a neighbor, even though the neighbor adjacency is established and both routers are in the same area.
Network Context
The network consists of two Cisco routers (R1 and R2) connected via a FastEthernet link in OSPF area 0. Both routers run IOS 15.x. The link bandwidth is 100 Mbps. R1's OSPF cost to reach a loopback on R2 is unexpectedly high, causing R1 to prefer a suboptimal path through a third router.
Diagnostic Steps
Check OSPF neighbor state
show ip ospf neighborNeighbor ID Pri State Dead Time Address Interface 2.2.2.2 1 FULL/DR 00:00:35 10.0.0.2 FastEthernet0/0
The neighbor state is FULL, indicating the adjacency is established. The problem is not with neighbor formation.
Examine OSPF interface cost
show ip ospf interface fastEthernet 0/0FastEthernet0/0 is up, line protocol is up Internet Address 10.0.0.1/24, Area 0 Process ID 1, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 10
The cost is 10. For a 100 Mbps link, the default OSPF cost should be 1 (reference bandwidth 100 Mbps / interface bandwidth 100 Mbps = 1). A cost of 10 indicates the reference bandwidth or interface bandwidth is misconfigured.
Check interface bandwidth
show interfaces fastEthernet 0/0FastEthernet0/0 is up, line protocol is up Hardware is Fast Ethernet, address is aaaa.bbbb.cccc MTU 1500 bytes, BW 10000 Kbit/sec, DLY 100 usec,
The bandwidth is 10000 Kbit/sec (10 Mbps), not the expected 100000 Kbit/sec (100 Mbps). This is the root cause: the interface bandwidth has been manually changed or is defaulting to a lower value.
Verify OSPF reference bandwidth
show running-config | section router ospfrouter ospf 1 network 10.0.0.0 0.0.0.255 area 0 auto-cost reference-bandwidth 1000
The reference bandwidth is set to 1000 Mbps. With interface bandwidth of 10 Mbps, cost = 1000/10 = 100. But the show ip ospf interface showed cost 10, so the reference bandwidth is actually 100 Mbps (default). The mismatch between interface bandwidth and actual link speed causes incorrect cost.
Root Cause
The FastEthernet interface bandwidth is misconfigured to 10 Mbps (10000 Kbit/sec) instead of the default 100 Mbps. This causes OSPF to calculate a higher cost (10) than expected (1), leading to suboptimal routing.
Resolution
Verification
Run 'show ip ospf interface fastEthernet 0/0' and verify cost is now 1 (or appropriate value). Also run 'show ip route ospf' to confirm the correct route is installed.
Prevention
1. Always verify interface bandwidth matches the physical link speed when configuring OSPF. 2. Use the 'auto-cost reference-bandwidth' command consistently across all routers to avoid cost mismatches. 3. Document any non-default bandwidth settings.
CCNA Exam Relevance
On the CCNA 200-301 exam, OSPF cost calculation is tested in multiple-choice and simulation questions. Candidates must know the formula: cost = reference bandwidth / interface bandwidth. The default reference bandwidth is 100 Mbps. A common trap is that the exam may change the interface bandwidth or reference bandwidth, leading to unexpected costs.
Exam Tips
Remember the default OSPF cost for FastEthernet is 1 (100/100). For GigabitEthernet, it's 1 as well (100/1000 = 0.1, but cost must be integer, so it becomes 1).
If the reference bandwidth is changed, all routers in the OSPF domain must have the same reference bandwidth to avoid routing loops.
Use 'show ip ospf interface' to quickly see the cost; if it seems off, check 'show interfaces' for bandwidth.
Commands Used in This Scenario
clear ip ospf process
Resets the OSPF process on the router, forcing it to re-establish all neighbor adjacencies and re-learn routes.
show interfaces
Displays detailed status and statistics for all interfaces or a specific interface, used to verify interface operational state, errors, and performance.
show ip ospf interface
Displays OSPF interface parameters and status, used to verify OSPF configuration and troubleshoot neighbor relationships.
Test Your CCNA Knowledge
Practice with scenario-based questions to prepare for the CCNA 200-301 exam.
Practice CCNA Questions