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 / 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 (multicast 224.0.0.5).
- OSPF uses areas for scalability — the CCNA covers single-area OSPF (all interfaces in Area 0).
Single-Area OSPFv2 — Concepts
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.
Why OSPF?
| Feature | OSPF | RIP | EIGRP |
|---|---|---|---|
| Type | Link-state | Distance-vector | Advanced distance-vector |
| Standard | Open (RFC 2328) | Open | Cisco-proprietary (now open) |
| Metric | Cost (bandwidth) | Hop count (max 15) | Composite (bandwidth + delay) |
| Convergence | Fast | Slow | Fast |
| Scalability | Excellent (with areas) | Poor | Good |
| AD | 110 | 120 | 90 |
| CCNA focus | Yes | Mentioned | Mentioned |
On the Exam: OSPF is the primary routing protocol tested on the CCNA. Know configuration, cost calculation, neighbor adjacencies, DR/BDR election, and troubleshooting.
How OSPF Works
Step 1: Discover Neighbors
OSPF routers send Hello packets to discover other OSPF routers on directly connected links.
Step 2: Form Adjacencies
Routers exchange Hello packets and transition through neighbor states to form full adjacencies.
Step 3: Exchange Link-State Information
Routers exchange Link-State Advertisements (LSAs) describing their interfaces and connected networks.
Step 4: Build the LSDB
Each router builds a Link-State Database (LSDB) — a complete map of the network topology. All routers in an area have identical LSDBs.
Step 5: Run SPF Algorithm
Each router runs Dijkstra's Shortest Path First algorithm on the LSDB to calculate the best path to every destination.
Step 6: Build the Routing Table
The SPF results are installed in the routing table.
OSPF Packet Types
| Type | Name | Purpose |
|---|---|---|
| 1 | Hello | Discover and maintain neighbor relationships |
| 2 | DBD (Database Description) | Summary of LSDB contents for synchronization |
| 3 | LSR (Link-State Request) | Request specific LSAs from a neighbor |
| 4 | LSU (Link-State Update) | Contains actual LSAs being sent |
| 5 | LSAck (Link-State Acknowledgment) | Confirms receipt of LSAs |
OSPF Cost Calculation
OSPF uses cost as its metric. The formula is:
Cost = Reference Bandwidth / Interface Bandwidth
Default reference bandwidth = 100 Mbps (100,000,000 bps)
| Interface Speed | Default Cost | Issue |
|---|---|---|
| 10 Mbps | 10 | Correct |
| 100 Mbps (FastEthernet) | 1 | Correct |
| 1 Gbps (GigabitEthernet) | 1 | Problem — same as FastEthernet! |
| 10 Gbps | 1 | Problem — same as FastEthernet! |
| 100 Gbps | 1 | Problem — same as FastEthernet! |
Fix: Increase the Reference Bandwidth
Router(config-router)# auto-cost reference-bandwidth 10000 ! 10 Gbps reference
With 10 Gbps reference:
| Interface Speed | Cost |
|---|---|
| 10 Mbps | 1000 |
| 100 Mbps | 100 |
| 1 Gbps | 10 |
| 10 Gbps | 1 |
Important: The reference bandwidth must be the same on ALL OSPF routers in the network for consistent cost calculation.
Manually Setting Interface Cost
Router(config-if)# ip ospf cost 5
OSPF Neighbor Requirements
For two OSPF routers to become neighbors, the following must match:
| Parameter | Must Match? | Notes |
|---|---|---|
| Area ID | Yes | Both interfaces must be in the same area |
| Hello/Dead timers | Yes | Default: Hello=10s, Dead=40s (broadcast); Hello=30s, Dead=120s (NBMA) |
| Authentication | Yes | If configured, both sides must use same type and key |
| Subnet/Mask | Yes | Interfaces must be on the same subnet |
| MTU | Yes | Mismatched MTU prevents full adjacency (stuck in ExStart) |
| Stub area flag | Yes | Both must agree on stub/NSSA area type |
| Router ID | No | Must be unique but does not need to match |
OSPF Neighbor States
| State | Description |
|---|---|
| Down | No Hello received from this neighbor |
| Init | Hello received but own Router ID not seen in neighbor's Hello |
| 2-Way | Bidirectional communication confirmed (both see each other's Router ID) |
| ExStart | Master/slave negotiation for DBD exchange |
| Exchange | DBD packets exchanged |
| Loading | LSRs and LSUs exchanged to synchronize LSDBs |
| Full | LSDBs synchronized — full adjacency established |
On the Exam: The most important states to understand are 2-Way (where DR/BDR election happens) and Full (complete adjacency). If a neighbor is stuck in ExStart/Exchange, check for MTU mismatch.
OSPF Areas
OSPF uses areas to improve scalability:
- Area 0 (backbone area): All areas must connect to Area 0
- Single-area OSPF: All interfaces in Area 0 (CCNA scope)
- Multi-area OSPF: Different networks in different areas (CCNP scope)
The CCNA exam focuses on single-area OSPF where all router interfaces are in Area 0.
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?
What is the OSPF administrative distance?