OSPF Routing Protocol Overview | Generated by AI
What is OSPF in Networking?
OSPF stands for Open Shortest Path First. It is a link-state routing protocol used inside a single autonomous system (AS) — that’s why it’s classified as an Interior Gateway Protocol (IGP).
Key Characteristics
| Feature | Description |
|---|---|
| Type | Link-state (vs. distance-vector like RIP) |
| Standard | Open standard (IETF RFC 2328 for OSPFv2, RFC 5340 for OSPFv3) |
| IP versions | OSPFv2 = IPv4 only, OSPFv3 = IPv6 (and can also do IPv4 with extensions) |
| Metric | Cost (based on interface bandwidth by default; Cisco: cost = 10^8 / bandwidth in bps) |
| Convergence | Very fast (typically seconds) because it floods LSAs when topology changes |
| Algorithm | Dijkstra’s Shortest Path First (SPF) algorithm |
| Areas | Hierarchical design using multiple areas (backbone Area 0 is mandatory) |
| Hello mechanism | Uses Hello packets to discover and maintain neighbors |
| Authentication | Supports plain text, MD5, and SHA cryptographic authentication |
| Scalability | Excellent — designed for large networks (hundreds/thousands of routers) |
How OSPF Works (simplified)
-
Neighbor Discovery
Routers send Hello packets on all OSPF-enabled interfaces (multicast 224.0.0.5). When two routers agree on parameters (area ID, authentication, timers, etc.), they become neighbors. -
Link-State Advertisement (LSA)
Each router creates LSAs describing its directly connected links and their state/cost. -
Flooding
LSAs are reliably flooded throughout the area (or the whole AS if single-area). Every router ends up with an identical link-state database (LSDB). -
SPF Calculation
Each router independently runs Dijkstra’s algorithm on the LSDB to build the shortest-path tree with itself as the root → creates the routing table. -
Areas & Hierarchy
To reduce flooding and SPF recalculation overhead in big networks, OSPF divides the AS into areas.- Area 0 (backbone) must connect all other areas.
- Non-backbone areas exchange summarized routes via Area Border Routers (ABRs).
Common LSA Types (OSPFv2)
| LSA Type | Name | Who generates | Scope |
|---|---|---|---|
| 1 | Router LSA | Every router | Within area |
| 2 | Network LSA | Designated Router (DR) on broadcast/NBMA | Within area |
| 3 | Summary LSA | ABR | Between areas |
| 4 | ASBR Summary LSA | ABR | Between areas |
| 5 | External LSA | ASBR (redistributing routes) | Entire AS |
| 7 | NSSA External LSA | ASBR in NSSA | NSSA only |
Advantages of OSPF
- Fast convergence
- Loop-free (because everyone has the full topology)
- Supports VLSM and manual route summarization
- Hierarchical design → scales well
- Load balancing over equal-cost paths (up to 16 by default on Cisco)
Disadvantages / Things to Watch
- Higher memory and CPU usage than distance-vector protocols (stores entire LSDB)
- More complex to configure and troubleshoot initially
- Strict area design rules (everything must touch Area 0 directly or via virtual links)
Quick Example (Cisco-style config snippet)
router ospf 1
router-id 1.1.1.1
network 10.0.0.0 0.0.255.255 area 0
network 192.168.1.0 0.0.0.255 area 1
default-information originate ! if this router is also redistributing
In short: OSPF is the de-facto standard IGP for most enterprise and service-provider IPv4/IPv6 networks when you need fast convergence and scalability. It’s the main alternative to IS-IS (which is very similar but more common in large ISP backbones).