NetworkTools
Sign In
1Static Routing2Dynamic Routing3OSPF Basics4OSPF Advanced5BGP Basics6BGP Path Selection7NAT8IPv6 Routing
← Back to Routing & IP

Learning Objectives

  • Understand OSPF's role as a link-state IGP
  • Visualize OSPF neighbor state transitions
  • Comprehend OSPF areas and hierarchical design
  • Interpret OSPF cost metrics

OSPF Overview

OSPF (Open Shortest Path First) is a link-state IGP that uses the Dijkstra SPF algorithm to compute the shortest path to every destination. It is the most widely deployed IGP in enterprise and service provider networks — preferred for its fast convergence, scalability, and support for hierarchical design via areas.

OSPF sends Hello packets out of every OSPF-enabled interface. When two routers share the same subnet and OSPF parameters, they form an adjacency. Over this adjacency, they exchange Link-State Advertisements (LSAs) describing their directly connected links. Every router builds an identical Link-State Database (LSDB) and independently computes the shortest-path tree with itself as root.

OSPF Neighbor States

OSPF routers progress through a series of states before becoming fully adjacent:

  1. Down — No Hello received from neighbor
  2. Attempt — (NBMA only) Actively trying to contact neighbor
  3. Init — Hello received, but own RID not in neighbor's Hello
  4. 2-Way — Bidirectional communication established (Hello seen on both sides)
  5. ExStart — Master/slave election for Database Description (DD) exchange
  6. Exchange — DD packets exchanged; router lists its LSDB contents
  7. Loading — Requesting and receiving full LSAs from neighbor
  8. Full — LSDBs synchronized; adjacency is complete

On broadcast multi-access networks (like Ethernet), a Designated Router (DR) and Backup Designated Router (BDR) are elected to reduce LSAs. The DR becomes the central point for LSA exchange.

OSPF Neighbor State Machine

R1R2

OSPF Areas and Hierarchical Design

OSPF divides the network into areas to contain LSDB size and reduce SPF computation. Every OSPF network must have an Area 0 (the backbone). All other areas must connect to Area 0.

Area types:

  • Standard Area — Accepts all LSAs
  • Stub Area — Blocks Type 5 LSAs; uses default route for external destinations
  • Totally Stubby — Blocks Type 3, 4, 5 LSAs; default route only
  • Not-So-Stubby-Area (NSSA) — Allows limited external routes via Type 7 LSAs

OSPF Multi-Area Design

Area Border Routers (ABRs) connect non-backbone areas to Area 0. They summarize routes between areas and reduce LSA flooding.

Area 0 (Backbone)ABR-1ABR-2R1R2Area 1 (Stub)Area 2 (NSSA)

OSPF Cost Metric

OSPF uses cost as its metric, derived from the interface bandwidth:

cost = reference-bandwidth / interface-bandwidth

By default, the reference bandwidth is 100 Mbps. A 100 Mbps Fast Ethernet link has cost 1. A 1 Gbps link would have cost 100/1000 = 0.1 — but OSPF only uses integers, so it rounds to 1. For modern networks, the reference bandwidth is typically raised to 10 Gbps or higher.

Why does OSPF use a Designated Router (DR) on broadcast networks?

What happens when two OSPF neighbors reach the Full state?

Key Takeaways

  • OSPF is a link-state IGP that uses the SPF algorithm for loop-free path computation
  • Neighbors progress through 8 states from Down to Full
  • Areas contain LSDB size; all areas must connect to Area 0
  • Cost is inversely proportional to bandwidth
  • DR/BDR election reduces LSA flooding on broadcast segments
PreviousDynamic RoutingNextOSPF Advanced