Before you ever type router ospf 1, you need a mental model for what OSPF is actually doing. The CCNA exam will hand you outputs, configs, and a topology and expect you to reason about why a route appeared, why a neighbor didn't, or which path traffic will take. That reasoning is impossible if you only memorize commands.
This is the article I wish I'd had before my first OSPF lab. No CLI, no copy running-config startup-config — just the concepts, in the order they actually become useful. When you're ready to run it on real gear, jump to the OSPF single-area lab and turn this into muscle memory.
★ DISTANCE-VECTOR vs LINK-STATE
Routing protocols fall into two big families. The difference between them is what each router actually knows.
A router only knows what its neighbors tell it. "To get to 10.0.0.0/8, go through me — it's 3 hops away." Each router accepts that on faith and passes it along.
It works, but it's slow to converge, it's vulnerable to loops, and it has no idea what the topology actually looks like. RIP literally caps the network at 15 hops because anything further is treated as unreachable.
Every router floods a description of its own links to every other router in the area. After flooding completes, every router has an identical map of the network — same routers, same links, same costs.
Each router then runs Dijkstra's shortest-path algorithm against that map to build its own routing table. No faith, no rumor — every router calculates paths from first principles using the same data.
The trade-off is CPU and memory. Distance-vector is dumb but cheap. Link-state is smart but every router has to hold the full map and recompute when it changes. For modern hardware that's a non-issue, which is why link-state IGPs (OSPF in enterprise, IS-IS in service provider) own the IGP space and RIP is effectively a teaching tool.
★ THE OSPF MENTAL MODEL
OSPF has four moving parts. Get these four and you can read any output the exam throws at you.
show ip ospf database.
That's it. Hellos build adjacencies. Adjacencies exchange LSAs. LSAs fill the LSDB. SPF turns the LSDB into a routing table. Every other OSPF concept hangs off those four.
★ AREAS — WHY JUST AREA 0 FOR THE CCNA
OSPF is hierarchical. You divide a large network into areas — groups of routers that share a single LSDB. Routers in different areas don't exchange full LSAs; they exchange summaries. That contains the size of the LSDB and the frequency of SPF recalculations.
The catch: every area has to connect to area 0, the backbone. All inter-area traffic transits area 0. If a non-backbone area has no direct adjacency to area 0, you're in virtual-link territory — exam-uncommon but real.
For the CCNA, you can put every router in area 0 and call it done. That's single-area OSPF, and it's exactly what the OSPF lab on this site walks through. Multi-area is a CCNP topic.
★ ROUTER-ID — HOW CISCO PICKS ONE, WHY YOU PIN IT
Every OSPF router needs a unique 32-bit identifier — the router-ID. It looks like an IP address but it isn't a packet destination; it's just a tag that uniquely identifies the router within the OSPF process.
Cisco picks the router-ID using this priority order, top wins:
1. The router-id command under router ospf — if you set one, it wins.
2. The highest IP on any up/up loopback interface.
3. The highest IP on any up/up physical interface at OSPF process start.
The third option is where you get burned. If you start OSPF, then later add a new interface with a higher IP, OSPF doesn't change its router-ID — the database still references the old one. Until you bounce the OSPF process with clear ip ospf process, your topology has an invisible mismatch.
Fix it with one line: router-id 1.1.1.1 at OSPF config. Pick something memorable (a dotted version of the router number is common). Now the router-ID is deterministic, the LSDB references stay stable, and you can read show ip ospf neighbor output at a glance.
★ PROCESS ID — LOCALLY SIGNIFICANT, EXAM TRAP
The number after router ospf — the process ID — is locally significant. It does not need to match between routers, despite what the syntax suggests.
R1 can run router ospf 1 while R2 runs router ospf 42 and they'll form an adjacency without issue. The process ID just lets a single router run multiple OSPF processes side-by-side if you ever need to (rare).
This trips up CCNA candidates because every other "matching number" in OSPF — area, timers, MTU — does need to match. The process ID is the exception. Expect at least one exam question that hinges on this.
★ WILDCARD MASKS — INVERSE OF A SUBNET MASK
When you tell OSPF which interfaces to run on, you use network statements with a wildcard mask, not a subnet mask. A wildcard mask is the bitwise inverse:
/24 subnet mask 255.255.255.0 → wildcard 0.0.0.255
/16 subnet mask 255.255.0.0 → wildcard 0.0.255.255
/30 subnet mask 255.255.255.252 → wildcard 0.0.0.3
The fast trick: subtract every octet of the subnet mask from 255. That's your wildcard.
So a network statement looks like: network 192.168.1.0 0.0.0.255 area 0. That reads "match any interface whose IP falls inside 192.168.1.0/24 and put it in area 0."
If you've worked through the subnetting article you already have the muscle for this. If not, the CIDR cheat sheet lists the wildcard for every common prefix.
★ THE ADJACENCY LIFECYCLE — PREVIEW
Forming an adjacency is a multi-step handshake. Two routers exchange Hellos, agree on parameters, elect a designated router if needed, then synchronize their databases. Each step has a state name you'll see in show ip ospf neighbor output:
DOWN → INIT → 2-WAY → EXSTART → EXCHANGE → LOADING → FULL
A healthy adjacency reaches FULL and stays there. If you see anything else lasting more than a few seconds, something is wrong — and the state tells you exactly which step failed.
The state names matter, but more importantly each one has a signature failure mode. The companion article on adjacency states walks each one, what it means, and the most common reason a neighbor gets stuck there (MTU mismatch hanging EXSTART being the classic).
★ WHERE OSPF FITS
You'll see four IGP families on the CCNA blueprint. Here's the one-line take on each:
OSPF — link-state, open standard, single most common IGP in enterprise networks. What the CCNA actually tests.
IS-IS — link-state, open standard, dominant in service-provider cores. Very similar mental model to OSPF, different encoding. Not tested on the CCNA but worth knowing exists.
EIGRP — Cisco's advanced distance-vector (technically hybrid). Fast, easy, Cisco-flavored. Still on the blueprint but losing ground.
RIP — original distance-vector. Educational value only at this point.
BGP is a separate beast — an exterior gateway protocol that runs between autonomous systems rather than inside one. CCNA touches it lightly; OSPF is where the real routing-protocol questions live.