OSPF Tutorial

9 min read

Open Shortest Path First (OSPF) is the most widely deployed interior gateway protocol in the world — largely because it’s a public, non-proprietary standard, unlike its biggest rival EIGRP, which started out as Cisco-proprietary (EIGRP has since been made public, as of 2013). OSPF is also considerably more complex than most other routing protocols, since it’s a link-state protocol rather than a distance-vector one.

Link-state protocols only send out routing updates when something in the topology actually changes. When a link’s state changes, whichever device noticed the change builds a Link-State Advertisement (LSA) describing it and floods that LSA to its neighbors using a special multicast address. Every router that receives a copy stores it in its own Link-State Database (LSDB) and forwards it on to its own neighbors in turn.

  • OSPF routers describe their own link state using LSAs; the LSDB is simply the full collection of LSAs a router has learned.
  • A router describes its own interface IP addresses using what’s called a Router LSA.
  • The moment OSPF starts on a router, its LSDB already contains exactly one entry — that router’s own Router LSA.

OSPF uses five distinct types of Link-State Packets (LSPs):

Example OSPF topology showing routers exchanging link-state information
A simple OSPF topology.
  • Hello: used to discover and maintain adjacency with other OSPF routers, and also to elect the Designated Router (DR) and Backup Designated Router (BDR) on multiaccess networks such as Ethernet or Frame Relay.
  • Database Description (DBD or DD): carries an abbreviated summary of the sending router’s LSDB, which the receiving router checks against its own database.
  • Link-State Request (LSR): used to ask a neighbor for more detail on a specific entry seen in a DBD.
  • Link-State Update (LSU): answers LSRs and also announces new information; a single LSU can carry any of OSPF’s seven LSA types.
  • Link-State Acknowledgement (LSAck): confirms that an LSU was received.

A quick list of OSPF’s defining characteristics:

  • A public, non-proprietary routing protocol.
  • The only link-state routing protocol covered in CCNA.
  • Uses Dijkstra’s algorithm to compute shortest paths.
  • Advertises local connectivity information to the whole network via multicast.
  • Shares routing information through Link-State Updates (LSAs).
  • Uses Hello packets to keep adjacencies alive — by default, every 10 seconds on multiaccess and point-to-point segments, and every 30 seconds on non-broadcast multiaccess (NBMA) segments such as Frame Relay, X.25, or ATM.
  • A classless protocol — it never assumes default subnet masks, since the subnet mask is included in every routing update.
  • Supports VLSM and route summarization.
  • Uses cost as its metric, which Cisco defines as the inverse of a link’s bandwidth.
  • Organizes large networks into areas for a hierarchical structure, limiting how far multicast LSAs need to travel. Area 0 is the backbone area, and every other area must connect to it directly. Every OSPF network needs a backbone area.
  • Only supports IP — which isn’t really a limitation, given that’s what everyone’s routing anyway.

A router with one interface in one area and another interface in a different area is called an Area Border Router (ABR).

// members only

The rest of this article is for members

The full walkthrough, configuration examples and verification steps are available exclusively to paid members.

View membership plans Log in