3.4 Single-Area OSPFv2 — Concepts
Key Takeaways
- OSPF is a link-state routing protocol that uses Dijkstra's SPF algorithm to find the shortest path.
- OSPF uses cost as its metric, calculated as reference bandwidth divided by interface bandwidth.
- The default reference bandwidth is 100 Mbps, making all Gigabit and faster links cost 1.
- OSPF routers form neighbor adjacencies by exchanging Hello packets to multicast 224.0.0.5.
- OSPF uses areas for scalability; the CCNA covers single-area OSPF with all interfaces in Area 0.
OSPF (Open Shortest Path First) is the most commonly used interior gateway protocol (IGP) in enterprise networks. It is an open-standard link-state routing protocol defined in RFC 2328, and it is the primary routing protocol tested on the CCNA 200-301 exam.
Why OSPF?
| Feature | OSPF | RIP | EIGRP |
|---|---|---|---|
| Type | Link-state | Distance-vector | Advanced distance-vector |
| Standard | Open (RFC 2328) | Open | Cisco (now open) |
| Metric | Cost (bandwidth) | Hop count (max 15) | Bandwidth + delay |
| Convergence | Fast | Slow | Fast |
| Scalability | Excellent (areas) | Poor | Good |
| AD | 110 | 120 | 90 |
How OSPF Works
Step 1 — Discover neighbors. Routers send Hello packets to discover OSPF speakers on directly connected links.
Step 2 — Form adjacencies. Routers exchange Hellos and progress through neighbor states until fully adjacent.
Step 3 — Exchange link state. Routers exchange Link-State Advertisements (LSAs) describing their interfaces, networks, and costs.
Step 4 — Build the LSDB. Each router assembles an identical Link-State Database (LSDB) — a full topology map of the area.
Step 5 — Run SPF. Each router runs Dijkstra's Shortest Path First algorithm against the LSDB, placing itself at the root of a shortest-path tree.
Step 6 — Install routes. Best paths from the SPF tree are installed into the routing table.
OSPF Packet Types
| Type | Name | Purpose |
|---|---|---|
| 1 | Hello | Discover and maintain neighbor relationships |
| 2 | DBD (Database Description) | Summarize LSDB contents for synchronization |
| 3 | LSR (Link-State Request) | Request specific LSAs from a neighbor |
| 4 | LSU (Link-State Update) | Carry the actual LSAs |
| 5 | LSAck | Acknowledge received LSAs |
OSPF runs directly over IP as protocol number 89 and uses multicast 224.0.0.5 (AllSPFRouters) for general traffic and 224.0.0.6 (AllDRouters) to reach the DR/BDR.
OSPF Cost Calculation
OSPF metric is cost, computed as:
Cost = Reference Bandwidth / Interface Bandwidth (result rounded up, minimum 1)
Default reference bandwidth = 100 Mbps.
| Interface Speed | Default Cost | Note |
|---|---|---|
| 10 Mbps | 10 | Correct |
| 100 Mbps (FastEthernet) | 1 | Correct |
| 1 Gbps | 1 | Same as FastEthernet — problem |
| 10 Gbps | 1 | Same as FastEthernet — problem |
Fix: Raise the Reference Bandwidth
Router(config-router)# auto-cost reference-bandwidth 10000 ! 10 Gbps reference
With a 10 Gbps reference, 1 Gbps becomes cost 10 and 10 Gbps becomes cost 1, restoring differentiation. The reference bandwidth must be identical on every OSPF router or path selection becomes inconsistent. You can also pin a value directly: ip ospf cost 5 under the interface.
OSPF Neighbor Requirements
Two routers will not become neighbors unless these match:
| Parameter | Must Match? | Notes |
|---|---|---|
| Area ID | Yes | Both interfaces in the same area |
| Hello/Dead timers | Yes | Defaults 10s/40s on broadcast; 30s/120s on NBMA |
| Authentication | Yes | Same type and key if used |
| Subnet/Mask | Yes | Interfaces on the same subnet |
| MTU | Yes | Mismatch stalls adjacency in ExStart |
| Stub/area type flag | Yes | Both agree on stub/NSSA |
| Router ID | No | Must be unique, need not match |
OSPF Neighbor States
| State | Description |
|---|---|
| Down | No Hello received |
| Init | Hello received, but own RID not yet seen in it |
| 2-Way | Bidirectional — each sees the other's RID; DR/BDR election happens here |
| ExStart | Master/slave negotiation for DBD exchange |
| Exchange | DBD packets exchanged |
| Loading | LSRs/LSUs exchanged to sync LSDBs |
| Full | LSDBs synchronized — full adjacency |
On the Exam: 2-Way is normal between two DROther routers and is not a fault. A neighbor stuck in ExStart/Exchange almost always means an MTU mismatch. Stuck in Init means one-way Hellos (an ACL or filter blocking return traffic).
OSPF Areas
- Area 0 is the backbone; every other area must connect to it.
- Single-area OSPF places all interfaces in Area 0 — this is the CCNA scope.
- Multi-area OSPF (different areas, ABRs) is CCNP-level.
Keeping everything in Area 0 keeps the LSDB simple and is exactly what CCNA configuration and troubleshooting items assume.
Link-State vs. Distance-Vector: Why It Matters
A distance-vector protocol like RIP shares its entire routing table with directly connected neighbors and trusts what they report — "routing by rumor." A link-state protocol like OSPF instead floods raw topology information (LSAs) so every router builds the same complete map and independently computes its own shortest paths. This gives OSPF faster, loop-free convergence and lets it use a real cost metric rather than a crude hop count. The trade-off is more memory and CPU to hold the LSDB and run SPF, which is why areas exist — they shrink each router's LSDB.
For the CCNA, connect the concept to behavior: OSPF reacts quickly to a failure because every router already holds the topology and only needs to rerun SPF.
Worked Example: Computing Cumulative Cost
OSPF cost is the sum of the outbound interface costs along the path from the router to the destination. Suppose R1 reaches network X through two Gigabit links (each cost 1 at the default reference) then one FastEthernet link (cost 1). With the default 100 Mbps reference, every hop costs 1, so the total is 3 — and a parallel path crossing three 10 Mbps links would total 30, so R1 picks the first path. The catch: at the default reference, Gigabit and 10-Gigabit links both cost 1, masking the faster path. Raising the reference bandwidth to 10000 makes Gigabit cost 10 and 10-Gigabit cost 1, so SPF can finally prefer the faster medium.
Why the Router ID Must Be Stable
The Router ID identifies a router uniquely in the LSDB and seeds tie-breaks like DR election. If you let it default to the highest interface IP and that interface later goes down, the RID could change and force the whole process to reconverge. That is why best practice — and the recommended exam answer — is to configure a loopback or a manual router-id, giving a value that never disappears with a physical interface.
What is the default OSPF cost for a GigabitEthernet interface using the default reference bandwidth of 100 Mbps?
Which OSPF packet type is used to discover and maintain neighbor relationships?
Two directly connected OSPF routers are stuck in the ExStart/Exchange state. What is the most likely cause?