What OSPF is in one line

Open Shortest Path First is an open-standard, classless,
link-state interior gateway protocol (IGP) that builds a full
map of the network topology and runs the SPF (Dijkstra)
algorithm to compute the shortest path to every destination.

Core characteristics

  • Link-state protocol — every router builds an identical map of
    the topology (within its own area) instead of relying on what
    neighbors tell it, as distance-vector protocols do.

  • Open standard — not vendor-locked. Defined in RFC 2328
    (OSPFv2, for IPv4) and RFC 5340 (OSPFv3, for IPv6).

  • Classless — carries the subnet mask inside its advertisements,
    so it supports VLSM and CIDR.

  • Administrative distance = 110 on Cisco.

  • Transported directly over IP as protocol number 89 — it
    does not use TCP or UDP. OSPF handles its own reliability through
    acknowledgements and retransmissions.

  • No periodic routing-table flooding — unlike RIP, OSPF does not
    resend the whole table on a timer. After initial sync it only sends
    updates when something changes.

  • Metric based on cost, derived from interface bandwidth.

  • Supports authentication and route summarization.

  • Supports ECMP (equal-cost multi-path load balancing).

Interior gateway protocol — where OSPF sits

IGP vs EGP

OSPF is an IGP: it routes within a single autonomous system
(one organization’s network). This contrasts with an EGP like
BGP, which routes between autonomous systems (e.g. across the
internet). OSPF’s job is fast, efficient routing inside your own
domain — not exchanging routes with other organizations.

Link-state vs distance-vector

Why "link-state" matters

A distance-vector protocol (RIP) knows only “which direction and
how far” — it trusts its neighbors’ summaries and never sees the full
picture (“routing by rumor”). A link-state protocol like OSPF
gives every router the raw topology data, so each one independently
calculates
its own shortest paths. The result: faster convergence,
loop avoidance, and far better scalability.

Key building blocks

Link, LSA, LSU, LSDB

  • A link is any active interface running OSPF with an IP address.
  • Routers exchange the state of their links using LSAs
    (Link-State Advertisements).
  • LSAs travel inside LSU (Link-State Update) packets.
  • Each LSA carries: the logical network it belongs to, the cost
    of the link (used for the metric), and the Router ID of the
    device that originated it.
  • Received LSAs are stored in the LSDB (Link-State Database),
    which must be identical on all routers in the same area.

”Every router has a map of the topology”

This is per-area, not domain-wide

Routers know the detailed topology of their own area only;
between areas they receive summarized information, not the full map.
This distinction is what makes multi-area OSPF scalable.

How OSPF operates (high level)

  1. Neighbor establishment — routers discover each other and agree
    on parameters through Hello packets.

  2. Database exchange — neighbors that form an adjacency exchange
    DBD / LSU so their LSDBs match.

  3. SPF execution — once the LSDB is synchronized, each router runs
    the Dijkstra algorithm on it to build a loop-free shortest-path
    tree, then installs the best routes.

  4. Topology maintenance — any change triggers flooding of the
    affected LSA and a re-run of SPF, contained within the area.

What SPF actually does

SPF (Dijkstra) takes the router itself as the root and calculates
the lowest-cost path to every known network, building a
“shortest-path tree.” A change does not wipe the LSDB — it
updates the changed LSA and recalculates the tree.

Multicast addresses

  • 224.0.0.5 — AllSPFRouters (all OSPF-speaking routers).
  • 224.0.0.6 — AllDRouters (the DR and BDR only).

Most OSPF messages use these; NBMA is the exception (unicast).

The three OSPF tables

What each router maintains

OSPF keeps three separate tables — a frequent interview question:

  • Neighbor table — every router it has formed an adjacency with
    (built from Hello packets).
  • Topology table (LSDB) — the full set of LSAs; identical across
    the area.
  • Routing table — the best (lowest-cost) routes SPF selected from
    the LSDB, actually used to forward traffic.