OSPF Complete Notes
OSPF Complete Notes
π§ OSPF (Open Shortest Path First) β Complete Notes
π© 1. Introduction to OSPF
| Aspect | Description |
|---|---|
| Full Name | Open Shortest Path First |
| Protocol Type | Interior Gateway Protocol (IGP) |
| Algorithm | Dijkstraβs Shortest Path First (SPF) |
| Standard | Open Standard (RFC 2328 for OSPFv2, RFC 5340 for OSPFv3) |
| Routing Type | Link-State |
| Administrative Distance (AD) | 110 |
| Transport Protocol | IP Protocol Number 89 |
π¨ 2. OSPF Versions
| Version | Used For | RFC | Notes |
|---|---|---|---|
| OSPFv2 | IPv4 networks | RFC 2328 | Most common in enterprise IPv4 |
| OSPFv3 | IPv6 networks | RFC 5340 | Supports IPv6, authentication via IPsec |
π§ 3. Basic Characteristics
- Classless routing (supports VLSM & CIDR)
- Manual summarization supported
- Fast convergence (SPF recalculation)
- Hierarchical design (areas)
- Equal-cost multipath (ECMP) supported
- Uses Hello packets to maintain adjacencies
- Authentication (Plain, MD5, IPsec)
π₯ 4. OSPF Packet Types
| Type | Name | Purpose |
|---|---|---|
| 1 | Hello | Discover and maintain neighbors |
| 2 | Database Description (DBD) | Summarize LSDB contents |
| 3 | Link-State Request (LSR) | Request missing LSAs |
| 4 | Link-State Update (LSU) | Send LSAs to neighbors |
| 5 | Link-State Acknowledgement (LSAck) | Confirm receipt of LSAs |
π¦ 5. OSPF Neighbor States
| State | Meaning |
|---|---|
| Down | No Hello received |
| Init | Hello received but not bidirectional |
| 2-Way | Bidirectional communication established |
| ExStart | Master/slave relationship formed |
| Exchange | DBD packets exchanged |
| Loading | LSR/LSU exchanged for LSDB sync |
| Full | LSDB synchronized |
πͺ 6. OSPF Network Types
| Type | Example | DR/BDR? | Hello / Dead Timers | Neighbor Discovery |
|---|---|---|---|---|
| Broadcast | Ethernet | Yes | 10s / 40s | Auto via multicast |
| Non-Broadcast | Frame Relay | Yes | 30s / 120s | Manual neighbors |
| Point-to-Point | Serial | No | 10s / 40s | Automatic |
| Point-to-Multipoint | Frame Relay (Hub-Spoke) | No | 30s / 120s | Manual or Auto |
π« 7. OSPF Areas & Hierarchy
| Concept | Description |
|---|---|
| Backbone Area (Area 0) | Core of OSPF; all other areas must connect here |
| Regular Area | Normal OSPF area with full LSAs |
| Stub Area | Blocks external LSAs (Type 5) |
| Totally Stubby Area | Blocks Type 3 & 5 LSAs, only default route |
| NSSA | Allows external routes as Type 7 LSAs |
| Totally NSSA | NSSA + blocks Type 3 LSAs |
Key Routers:
- ABR (Area Border Router): Connects multiple areas
- ASBR (Autonomous System Boundary Router): Redistributes routes between protocols
π¨ 8. OSPF LSA (Link-State Advertisement) Types
| Type | Name | Generated By | Flooded To | Purpose |
|---|---|---|---|---|
| 1 | Router LSA | Every router | Within area | Describes router links |
| 2 | Network LSA | DR | Within area | Describes multiaccess networks |
| 3 | Summary LSA | ABR | Between areas | Advertises inter-area networks |
| 4 | ASBR Summary LSA | ABR | Between areas | Advertises ASBR location |
| 5 | AS External LSA | ASBR | All areas (except stub) | External routes (E1/E2) |
| 6 | Multicast OSPF | Deprecated | β | Used in MOSPF |
| 7 | NSSA External | NSSA ASBR | NSSA | External routes in NSSA |
| 8 | Link LSA (OSPFv3) | Router | Within link | IPv6 link-local info |
| 9β11 | Opaque LSAs | Various | β | Used for extensions (e.g., TE) |
π§ 9. OSPF Route Types and Metrics
| Type | Meaning | Metric |
|---|---|---|
| O (Intra-Area) | Within the same area | Interface cost |
| O IA (Inter-Area) | From another area | Sum of costs to ABR |
| E1 (External Type 1) | Redistributed + internal cost | Internal + External |
| E2 (External Type 2) | Redistributed only | External only |
| N1/N2 (NSSA) | NSSA external routes | Like E1/E2 |
Default OSPF Cost Formula:
1
2
Cost = Reference Bandwidth / Interface Bandwidth
Default Reference Bandwidth = 100 Mbps
Example:
- 10 Mbps β Cost = 10
- 1 Gbps β Cost = 1 (unless ref bandwidth adjusted)
To modify reference bandwidth:
1
auto-cost reference-bandwidth 10000
π¦ 10. OSPF Timers
| Parameter | Default (Broadcast/P2P) | Default (NBMA/P2MP) |
|---|---|---|
| Hello Interval | 10s | 30s |
| Dead Interval | 40s | 120s |
| LSA Refresh Time | 30 min | β |
| SPF Delay | 5s (default Cisco) | β |
π₯ 11. OSPF Authentication
| Type | Supported in | Description |
|---|---|---|
| None | v2/v3 | No authentication |
| Simple (Plain Text) | v2 | Password in clear text |
| MD5 | v2 | Hash-based authentication |
| IPsec | v3 | Built into IPv6 header (ESP/AH) |
π© 12. OSPF Design Best Practices
- Use Area 0 (Backbone) as the core.
- Avoid >50 routers per area (recommended).
- Summarize routes on ABRs and ASBRs.
- Keep LSDB sizes small to reduce SPF recalculation.
- Use loopback interfaces for router IDs.
- Adjust hello/dead timers for faster convergence if needed.
π¨ 13. OSPF Key Cisco Commands
| Purpose | Command |
|---|---|
| Enable OSPF | router ospf <process-id> |
| Assign network | network <ip> <wildcard> area <area-id> |
| Set router ID | router-id <id> |
| Check neighbors | show ip ospf neighbor |
| View database | show ip ospf database |
| Check interfaces | show ip ospf interface |
| Debug adjacency | debug ip ospf adj |
| Configure passive interface | passive-interface <interface> |
| Summarize route (ABR) | area <area-id> range <ip> <mask> |
| Redistribute routes | redistribute <protocol> |
πͺ 14. OSPFv3 (for IPv6) Enhancements
- Runs on per-link basis, not per subnet.
- Router ID still 32-bit (IPv4 format).
- Authentication handled by IPsec.
- Uses Link-LSAs (Type 8) and Intra-Area Prefix LSAs (Type 9).
- Activated via interface configuration:
1
2
ipv6 unicast-routing
ipv6 ospf <process-id> area <area-id>
π« 15. Troubleshooting Checklist
- Check interface up/up
- Hello/dead intervals match
- Area IDs match
- Authentication matches
- Same network type
- Unique router IDs
- MTU mismatch (common cause of stuck in EXSTART)
- Check LSDB synchronization
π§ Summary Mind-Map
1
2
3
4
5
6
7
8
9
10
11
12
OSPF
βββ Type: Link-State, IGP, Classless
βββ Versions: v2 (IPv4), v3 (IPv6)
βββ Hierarchical Areas
β βββ Backbone (0)
β βββ Stub / NSSA
βββ LSAs (1β7)
βββ Adjacency States (Down β Full)
βββ DR/BDR (on multiaccess)
βββ Metrics = Cost (Reference BW / Interface BW)
βββ Route Types: O, OIA, E1/E2, N1/N2
βββ Authentication: None, Simple, MD5, IPsec
π Connect With Me
This post is licensed under CC BY 4.0 by the author.