Networking · Concepts

OSPF Explained

By CertSharp Team~10 min read

OSPF (Open Shortest Path First) is the routing protocol candidates spend the most CCNA study time on, and for good reason — it carries the largest chunk of the IP Connectivity domain, the single biggest section of the 200-301 exam. Get the mechanics solid and a meaningful share of that domain's questions become straightforward.

The mental model

Picture every router in an OSPF network building its own copy of a complete road map — not just a list of "next turn" directions, but the entire layout: every road, every intersection, every distance. Once every router has the same map, each one independently calculates the shortest route to every destination using that map. This is fundamentally different from a routing protocol where routers only tell each other "go this way" without sharing the full picture.

OSPF is a link-state protocol. This matters because it explains almost everything else about how OSPF behaves:

  • Link-state (OSPF): every router builds an identical, complete topology database, then independently runs Dijkstra's shortest-path-first algorithm against it. Convergence is fast because every router already has the full picture when a change happens.
  • Distance-vector (RIP, and EIGRP as an advanced hybrid): routers only know what their direct neighbors tell them — "I can reach network X in N hops" — without seeing the full topology.

This is why OSPF requires more router CPU and memory than distance-vector protocols — it is doing real computation, not just repeating what neighbors said.

How neighbor adjacency forms

Two OSPF routers go through a defined sequence before they become full neighbors and start exchanging routing information:

  1. Down: no Hello packets received yet.
  2. Init: a Hello packet was received, but the router has not yet seen itself listed in the neighbor's Hello.
  3. 2-Way: both routers see each other in their neighbors' Hello packets — bidirectional communication confirmed.
  4. ExStart / Exchange: routers negotiate master/slave roles and exchange database description packets.
  5. Loading: routers request any missing link-state information from each other.
  6. Full: both routers have identical topology databases — the adjacency is complete and routes are calculated.

For two routers to progress past 2-Way, several values must match exactly: the area ID, the hello and dead timers, the subnet mask on the shared segment, and the authentication settings (if configured). A mismatch on any of these silently prevents adjacency — this is the most common real-world OSPF troubleshooting scenario.

DR and BDR election

On multi-access networks (like an Ethernet segment with three or more routers), OSPF elects a Designated Router (DR) and Backup Designated Router (BDR) to reduce the number of adjacencies needed. Instead of every router forming a full adjacency with every other router (an inefficient full mesh), all routers form full adjacencies only with the DR and BDR, and stay in a lighter 2-Way state with each other.

Election criteria, in order:

  1. Highest OSPF priority (configurable per interface, default 1; a priority of 0 makes a router ineligible to become DR/BDR).
  2. Highest Router ID as the tiebreaker — typically the highest IP address on a loopback interface, or the highest active physical interface IP if no loopback exists.

Point-to-point links (a direct connection between exactly two routers) skip DR/BDR election entirely — there is no need to reduce adjacency count when only two routers exist on the segment.

Areas and why they exist

A single, flat OSPF network becomes computationally expensive as it grows — every router recalculating the full topology on every change does not scale. Areas solve this by dividing the network into smaller sections, each maintaining its own detailed topology database, while only summarized routing information crosses area boundaries.

  • Area 0 (the backbone) is mandatory in any multi-area OSPF design — every other area must connect to it, directly or through a virtual link.
  • A router with interfaces in two different areas is an Area Border Router (ABR).
  • CCNA-level OSPF is typically single-area (all routers in Area 0) — multi-area design goes deeper at the CCNP level, but recognizing the vocabulary is fair game.

The cost metric, worked example

OSPF's metric is cost, calculated per interface as: reference bandwidth ÷ interface bandwidth. Cisco IOS defaults the reference bandwidth to 100 Mbps (100,000 Kbps).

Interface bandwidthOSPF cost (default reference)
10 Mbps (Ethernet)10
100 Mbps (Fast Ethernet)1
1 Gbps (Gigabit Ethernet)1 (rounds down — see note)

Worked example: a packet crosses two Fast Ethernet links (cost 1 each) to reach its destination. Total path cost = 1 + 1 = 2. If an alternate path crosses one 10 Mbps link (cost 10), OSPF prefers the two-hop Fast Ethernet path because its total cost (2) is lower — fewer hops does not automatically mean a better path in OSPF.

Note: with the default 100 Mbps reference bandwidth, both Fast Ethernet and Gigabit Ethernet round to a cost of 1, meaning OSPF cannot tell them apart by default. Network engineers commonly raise the reference bandwidth (auto-cost reference-bandwidth) on modern high-speed networks to restore meaningful cost differentiation — a detail worth knowing conceptually for CCNA even though configuring it is beyond the exam's core scope.

LSAs at a glance

Routers exchange Link-State Advertisements (LSAs) to build their shared topology database. CCNA-level awareness of the two most common types is sufficient:

  • Type 1 (Router LSA): describes a router's own directly connected links, flooded within its area.
  • Type 2 (Network LSA): generated by the DR on a multi-access segment, describing all routers attached to that segment.

OSPF vs EIGRP

CCNA expects deep OSPF fluency but only conceptual EIGRP awareness. The key distinction: OSPF is an open standard link-state protocol (works across vendors); EIGRP is Cisco-proprietary and technically an advanced distance-vector protocol, though it behaves faster than classic distance-vector protocols thanks to its DUAL algorithm and feasible successor concept. Full comparison table in the CCNA cheat sheet.

Why adjacencies fail to form

The most common real-world (and exam simlet) causes, roughly in order of frequency:

  1. Area ID mismatch — both ends of a link must be configured for the same OSPF area.
  2. Hello/dead timer mismatch — both routers must agree on how often to send Hellos and how long to wait before declaring a neighbor dead.
  3. Subnet mask mismatch — routers on the same segment must agree on the subnet boundaries.
  4. MTU mismatch — mismatched maximum transmission unit sizes can stall the Exchange state specifically, a distinctive symptom worth recognizing.
  5. Authentication mismatch — if configured, both sides must match exactly.
  6. Passive interface misconfiguration — a passive interface suppresses Hello packets entirely, which looks identical to a cabling problem from the neighbor router's perspective.

Common misconceptions

  • “OSPF always picks the path with the fewest hops.” False — it picks the lowest total cost, which can favor a longer path over higher-bandwidth links, as shown in the worked example above.
  • “Every OSPF network elects a DR and BDR.” False — only multi-access segments do; point-to-point links skip election entirely.
  • “OSPF and EIGRP can share routes automatically.” False — they are independent protocols with different metrics and require explicit redistribution to exchange routes.
  • “A router with the highest priority always becomes DR.” Mostly true, but only at election time — OSPF does not re-elect a new DR just because a higher-priority router joins later (the existing DR keeps its role until it fails or the segment resets).

How this is tested on CCNA

Expect a mix of pure recall (default administrative distance is 110, default reference bandwidth is 100 Mbps), applied cost calculations across multiple hops, DR/BDR election logic, and troubleshooting scenarios — sometimes as simlets — where you must read show ip ospf neighbor or show ip ospf interface output and identify why an expected adjacency has not formed. A reliable heuristic: if the question describes two routers stuck below Full state, check area ID, timers, and MTU first — those three cover the large majority of real adjacency failures.

For the full CCNA routing metric comparison and administrative distance table, see the CCNA cheat sheet. You can also drill this concept specifically in CertSharp's 500-question CCNA bank.

Frequently asked questions

What is OSPF in one sentence?

OSPF (Open Shortest Path First) is an open-standard, link-state routing protocol that builds a complete map of a network from every router's perspective, then calculates the mathematically shortest path to each destination using Dijkstra's algorithm.

What is the default OSPF metric, and how is it calculated?

The default OSPF metric is cost, calculated as a reference bandwidth (100 Mbps by default on most Cisco IOS versions) divided by the interface bandwidth. A 100 Mbps interface has a cost of 1; a 10 Mbps interface has a cost of 10. The total path cost is the sum of every outgoing interface's cost along the route.

Why does OSPF elect a DR and BDR on some networks but not others?

OSPF only elects a Designated Router (DR) and Backup Designated Router (BDR) on multi-access network types (like Ethernet), where multiple routers share the same segment. On point-to-point links, where only two routers exist, there is nothing to elect — both routers simply become full neighbors directly.

How is this tested on the CCNA exam?

Expect both conceptual questions (DR/BDR election criteria, administrative distance, cost calculation) and troubleshooting scenarios, sometimes inside a simulation-style item, where you must diagnose why two routers are not forming an OSPF neighbor adjacency from a show command's output.

Test yourself on this concept

30 free CCNA questions cover OSPF scenarios directly — no signup, no credit card. Full 500-question bank is $11.99 lifetime, or $9.99/month Pro unlocks every CertSharp certification.