OSPF (Open Shortest Path First)
A Link-State protocol that builds a complete topological map of the network using Dijkstra's SPF algorithm. It is the industry standard for enterprise IGP.
1. Fundamental Mechanics
OSPF routers communicate via IP Protocol 89. They send Hello packets to discover neighbors and form adjacencies. Once adjacent, they exchange LSAs (Link State Advertisements) to synchronize their LSDB (Link State Database).
- Metric: Cost (Reference Bandwidth / Interface Bandwidth). Default Ref BW is 100 Mbps (
10^8).- 100 Mbps Link = Cost 1
- 1 Gbps Link = Cost 1 (Problematic! Update auto-cost reference-bandwidth to 1000 or higher).
- Multicast Addresses:
224.0.0.5(All OSPF Routers),224.0.0.6(DR/BDR only).
2. LSA Types (The Building Blocks)
Understanding LSAs is key to troubleshooting OSPF. They define the "scope" of information.
| Type | Name | Generated By | Scope | Description |
|---|---|---|---|---|
| 1 | Router | Every Router | Intra-Area | "I am Router X, I have links A, B, C with these costs." |
| 2 | Network | DR | Intra-Area | "I am the DR for this Ethernet segment. Routers X, Y, Z are attached here." |
| 3 | Summary | ABR | Inter-Area | "I can reach Network N in another area with Cost C." (Aggregates Type 1/2). |
| 4 | ASBR Summary | ABR | Global | "I know how to reach the ASBR (Router Y). Here is the cost." |
| 5 | External | ASBR | Global | "I know an external route (e.g., Internet/EIGRP) to Network Z." |
| 7 | NSSA External | ASBR (in NSSA) | NSSA Only | Same as Type 5, but allowed inside a Not-So-Stubby Area. ABR converts this to Type 5. |
3. OSPF Area Types
Areas reduce the size of the LSDB and limit LSA flooding.
Standard Area
The default. Accepts all LSA types (1, 2, 3, 4, 5). Routes are detailed.
Stub Area
Goal: Reduce routing table size on edge routers.
- Blocks Type 5 (External) LSAs.
- Blocks Type 4 LSAs.
- ABR injects a default route (0.0.0.0/0).
- Routers still receive Type 3 (Inter-Area) routes.
Totally Stubby Area (Cisco Proprietary)
Goal: Maximum reduction.
- Blocks Type 3, 4, and 5.
- The ONLY way out is the default route injected by the ABR.
- Configuration:
area 1 stub no-summaryon the ABR.
NSSA (Not-So-Stubby Area)
Goal: Like a Stub, but you have a local external connection (e.g., a 4G modem or partner link).
- Allows external routes to enter as Type 7 LSAs.
- The ABR translates Type 7 -> Type 5 to flood to the rest of the network.
4. Network Types
How OSPF behaves depends on the Layer 2 medium.
| Type | Default On | Hello Timer | DR/BDR? |
|---|---|---|---|
| Broadcast | Ethernet | 10s | Yes |
| Point-to-Point | Serial / HDLC | 10s | No |
| Non-Broadcast (NBMA) | Frame Relay / X.25 | 30s | Yes (Manual Neighbors) |
A Loopback interface defaults to LOOPBACK network type, which advertises the IP as a /32 host route, regardless of the configured mask. To advertise the full subnet (e.g. /24), change it: ip ospf network point-to-point.
5. Neighbor States (FSM)
Troubleshooting stuck adjacencies requires knowing the states.
- Down: Dead.
- Init: Hello received, but I'm not in the neighbor list.
- 2-Way: Bidirectional comms established. DR Election happens here. (Stable state for DROTHERs).
- ExStart: Master/Slave negotiation. Stuck here? Check MTU.
- Exchange: Sending DBD headers.
- Loading: Requesting full LSAs (LSR/LSU).
- Full: Converged.
References
- RFC 2328: OSPF Version 2 - The official IETF standard definition.
- Cisco OSPF Design Guide - Comprehensive guide on area hierarchy and LSA types.
- RFC 3101: The OSPF Not-So-Stubby Area (NSSA) Option - Details on Type 7 LSAs.