Post

OSPF Complete Notes

OSPF Complete Notes

🧭 OSPF (Open Shortest Path First) – Complete Notes


🟩 1. Introduction to OSPF

AspectDescription
Full NameOpen Shortest Path First
Protocol TypeInterior Gateway Protocol (IGP)
AlgorithmDijkstra’s Shortest Path First (SPF)
StandardOpen Standard (RFC 2328 for OSPFv2, RFC 5340 for OSPFv3)
Routing TypeLink-State
Administrative Distance (AD)110
Transport ProtocolIP Protocol Number 89

🟨 2. OSPF Versions

VersionUsed ForRFCNotes
OSPFv2IPv4 networksRFC 2328Most common in enterprise IPv4
OSPFv3IPv6 networksRFC 5340Supports 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

TypeNamePurpose
1HelloDiscover and maintain neighbors
2Database Description (DBD)Summarize LSDB contents
3Link-State Request (LSR)Request missing LSAs
4Link-State Update (LSU)Send LSAs to neighbors
5Link-State Acknowledgement (LSAck)Confirm receipt of LSAs

🟦 5. OSPF Neighbor States

StateMeaning
DownNo Hello received
InitHello received but not bidirectional
2-WayBidirectional communication established
ExStartMaster/slave relationship formed
ExchangeDBD packets exchanged
LoadingLSR/LSU exchanged for LSDB sync
FullLSDB synchronized

πŸŸͺ 6. OSPF Network Types

TypeExampleDR/BDR?Hello / Dead TimersNeighbor Discovery
BroadcastEthernetYes10s / 40sAuto via multicast
Non-BroadcastFrame RelayYes30s / 120sManual neighbors
Point-to-PointSerialNo10s / 40sAutomatic
Point-to-MultipointFrame Relay (Hub-Spoke)No30s / 120sManual or Auto

🟫 7. OSPF Areas & Hierarchy

ConceptDescription
Backbone Area (Area 0)Core of OSPF; all other areas must connect here
Regular AreaNormal OSPF area with full LSAs
Stub AreaBlocks external LSAs (Type 5)
Totally Stubby AreaBlocks Type 3 & 5 LSAs, only default route
NSSAAllows external routes as Type 7 LSAs
Totally NSSANSSA + blocks Type 3 LSAs

Key Routers:

  • ABR (Area Border Router): Connects multiple areas
  • ASBR (Autonomous System Boundary Router): Redistributes routes between protocols

TypeNameGenerated ByFlooded ToPurpose
1Router LSAEvery routerWithin areaDescribes router links
2Network LSADRWithin areaDescribes multiaccess networks
3Summary LSAABRBetween areasAdvertises inter-area networks
4ASBR Summary LSAABRBetween areasAdvertises ASBR location
5AS External LSAASBRAll areas (except stub)External routes (E1/E2)
6Multicast OSPFDeprecatedβ€”Used in MOSPF
7NSSA ExternalNSSA ASBRNSSAExternal routes in NSSA
8Link LSA (OSPFv3)RouterWithin linkIPv6 link-local info
9–11Opaque LSAsVariousβ€”Used for extensions (e.g., TE)

🟧 9. OSPF Route Types and Metrics

TypeMeaningMetric
O (Intra-Area)Within the same areaInterface cost
O IA (Inter-Area)From another areaSum of costs to ABR
E1 (External Type 1)Redistributed + internal costInternal + External
E2 (External Type 2)Redistributed onlyExternal only
N1/N2 (NSSA)NSSA external routesLike 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

ParameterDefault (Broadcast/P2P)Default (NBMA/P2MP)
Hello Interval10s30s
Dead Interval40s120s
LSA Refresh Time30 minβ€”
SPF Delay5s (default Cisco)β€”

πŸŸ₯ 11. OSPF Authentication

TypeSupported inDescription
Nonev2/v3No authentication
Simple (Plain Text)v2Password in clear text
MD5v2Hash-based authentication
IPsecv3Built 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

PurposeCommand
Enable OSPFrouter ospf <process-id>
Assign networknetwork <ip> <wildcard> area <area-id>
Set router IDrouter-id <id>
Check neighborsshow ip ospf neighbor
View databaseshow ip ospf database
Check interfacesshow ip ospf interface
Debug adjacencydebug ip ospf adj
Configure passive interfacepassive-interface <interface>
Summarize route (ABR)area <area-id> range <ip> <mask>
Redistribute routesredistribute <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

  1. Check interface up/up
  2. Hello/dead intervals match
  3. Area IDs match
  4. Authentication matches
  5. Same network type
  6. Unique router IDs
  7. MTU mismatch (common cause of stuck in EXSTART)
  8. 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

GitHub LinkedIn YouTube Gmail

This post is licensed under CC BY 4.0 by the author.