Days 26, 27, 28: OSPF
CCNA Study Guide: OSPFv2 (Exam Topic 3.4)
1.0 OSPFv2 Fundamentals: The Link-State Advantage
Open Shortest Path First (OSPF) is a Link-State Interior Gateway Protocol (IGP). Unlike distance-vector protocols that rely on "routing by rumor," OSPF routers build a complete, synchronized map of the network topology.
The Metaphor: The GPS vs. The Signpost
-
Distance Vector (RIP): Like a signpost. It tells you "Network X is 4 miles that way," but you don't know what the road looks like or if there is a bridge out further ahead.
-
Link-State (OSPF): Like a GPS map. Every router has a complete map of every "road" (link) and "intersection" (router) in the area. Each router can independently calculate the best path using the map.
Core Characteristics
|
Attribute |
Description |
|
Protocol Type |
Link-State IGP |
|
Algorithm |
Dijkstra’s Shortest Path First (SPF) |
|
Admin Distance (AD) |
110 |
|
Multicast Addresses |
224.0.0.5 (All OSPF Routers), 224.0.0.6 (DR/BDR) |
2.0 The Path to Adjacency: OSPF Core Operations
OSPF routers must go through a structured process to become fully adjacent and synchronize their Link State Database (LSDB).
The 3-Step Process
-
Become Neighbors: Routers discover each other via Hello packets.
-
Exchange LSAs: Routers share Link State Advertisements (LSAs) to synchronize their databases.
-
Calculate Routes: Once the LSDB is identical, each router runs the SPF algorithm to find the best paths.
OSPFv2 Neighbor States
|
State |
Description |
|
Down |
No Hellos received. |
|
Init |
Hello received, but your own Router ID is not in the neighbor's list. |
|
2-Way |
Bidirectional communication confirmed (DR/BDR election happens here). |
|
ExStart |
Determining Master/Slave relationship for data exchange. |
|
Exchange |
Exchanging Database Descriptors (DBDs) (summaries of the LSDB). |
|
Loading |
Requesting specific missing info via LSRs and LSUs. |
|
Full |
LSDBs are fully synchronized. Normal operation. |
3.0 Essential OSPF Components
3.1 Router ID (RID) Selection
The RID is a unique 32-bit identifier for the router. It is selected in this order:
-
Manual Configuration: router-id 1.1.1.1 (Best Practice).
-
Highest Loopback IP: Highest IP on any active loopback interface.
-
Highest Physical IP: Highest IP on any active physical interface.
3.2 The OSPF Metric: Cost
OSPF calculates cost based on interface bandwidth. A lower cumulative cost is preferred.
$$Cost = \frac{Reference\ Bandwidth}{Interface\ Bandwidth}$$
Important: The default reference bandwidth is 100 Mbps. On modern networks (Gigabit or 10G), you must manually increase this to ensure OSPF can distinguish between different high-speed links.
-
Command: auto-cost reference-bandwidth 1000 (for 1 Gbps links).
3.3 LSA Types (CCNA Focus)
-
Type 1 (Router LSA): Sent by every router; describes its own links/interfaces.
-
Type 2 (Network LSA): Generated by the Designated Router (DR); describes the routers on a multi-access segment.
-
Type 5 (External LSA): Describes routes redistributed from outside the OSPF domain (e.g., a Static Route).
4.0 Network Types and the DR/BDR Election
On multi-access networks (like Ethernet), OSPF elects a Designated Router (DR) and a Backup Designated Router (BDR) to manage LSA flooding and reduce the number of adjacencies.
|
Feature |
Broadcast (Ethernet) |
Point-to-Point (Serial) |
|
DR/BDR Election |
Yes |
No |
|
Hello / Dead Timer |
10s / 40s |
10s / 40s |
DR/BDR Election Hierarchy
-
Highest Interface Priority: Default is 1. A priority of 0 makes a router ineligible.
-
Highest Router ID: The tie-breaker if priorities are equal.
Note: The election is non-preemptive. If a new router with a higher priority joins the network, it will not become the DR until the current DR/BDR process is reset or the current DR fails.
5.0 OSPFv2 Configuration
5.1 Basic Implementation
# Method 1: Traditional Network Command
Router(config)# router ospf 1
Router(config-router)# router-id 1.1.1.1
Router(config-router)# network 10.1.1.0 0.0.0.255 area 0
# Method 2: Interface-level Command (Preferred)
Router(config)# interface g0/0
Router(config-if)# ip ospf 1 area 0
5.2 Common Optimizations
-
Passive Interface: Prevents Hellos from being sent to user segments (Security/Efficiency).
-
passive-interface g0/1
-
-
Default Route Propagation:
-
default-information originate (Injects the 0.0.0.0/0 route into OSPF).
-
6.0 Troubleshooting OSPF Adjacency Issues
If two routers fail to reach the FULL state, check for mismatches in these parameters:
-
Area ID: Must match.
-
Subnet & Mask: Must be on the same primary subnet.
-
Hello/Dead Timers: Must match (Default 10/40).
-
Authentication: Passwords and types must match.
-
MTU Size: If they mismatch, routers get stuck in ExStart/Exchange.
-
Unique Router IDs: Duplicate RIDs prevent adjacency.
TL;DR Summary
-
Link-State: OSPF uses a map (LSDB), not rumors.
-
Election: Lowest Bridge ID wins (Priority, then RID).
-
Cost Formula: Reference Bandwidth / Interface Bandwidth.
-
Convergence: Moves through 7 states; FULL is the goal.
-
Multi-access: Uses DR/BDR to reduce LSA flooding on Ethernet.
-
Troubleshooting: Check Area, Timers, Subnet, and MTU if adjacencies fail.