Every router running OSPF builds an identical map of the network and then works out its own best paths from that map. That single idea is what separates OSPF from older protocols, and it explains almost everything else: why routers form neighbor relationships, why a broadcast segment elects a designated router, and why the link-state database matters more than the routing table when you are troubleshooting. This guide walks the OSPF concepts a CCNA candidate has to understand, each one shown on a live three-router lab. Every command here was run on three Cisco IOS 15.2 routers sharing one Ethernet segment in June 2026.
OSPF is one of the routing protocols introduced in the IP routing and routing protocols overview, and the routes it computes land in the table covered in the Cisco routing table guide. Configuring OSPF is a separate topic; this article is about how OSPF actually thinks.
How OSPF builds a map of the network
OSPF is a link-state protocol. Instead of passing its whole routing table to neighbors the way RIP does, each router describes its own links in a link-state advertisement (LSA) and floods that to every other router in the area. Every router collects all the LSAs into a link-state database (LSDB), so they all hold an identical picture of the topology. Each then runs the SPF (Dijkstra) algorithm against that database to calculate the shortest path to every destination. The lab is three routers on one shared segment, all in area 0.

Neighbors and adjacencies
Before any of that flooding happens, routers have to become neighbors. OSPF uses the Hello protocol: it sends Hello packets out OSPF-enabled interfaces, and two routers become neighbors when the values in those Hellos agree. The area ID, the hello and dead timers, the subnet and mask, and authentication all have to match, or the adjacency never forms. Once it does, show ip ospf neighbor lists each neighbor, the state, and that neighbor’s role:

The state column reads as two parts. FULL means the databases are fully synchronized, and the part after the slash is the neighbor’s role on this segment. So R1 sees 3.3.3.3 as FULL/DR and 2.2.2.2 as FULL/BDR. Adjacencies climb through a sequence of states to get there: Down, Init, 2-Way, ExStart, Exchange, Loading, and finally Full. Reaching 2-Way means the routers see each other; reaching Full means their databases match. The whole lab runs on a clean GNS3 canvas, three c7200 routers hanging off one IOSvL2 switch:

DR and BDR on a broadcast network
If every router on a shared segment formed a full adjacency with every other router, the number of adjacencies would explode as the segment grew. OSPF avoids that by electing a designated router (DR) and a backup designated router (BDR). Every other router, a DROTHER, forms a full adjacency only with the DR and BDR, and stays at 2-Way with the other DROTHERs. Point-to-point links elect no DR or BDR because there are only two routers. The election and the timers show up in show ip ospf interface:

The network type is BROADCAST, which is why a DR is elected at all, and this router is in state DROTHER with the DR and BDR named explicitly. The DR is decided by the highest OSPF interface priority; when priorities tie at the default of 1, the highest router ID wins, which is why R3 (3.3.3.3) became DR and R2 (2.2.2.2) the BDR. A priority of 0 takes a router out of the running entirely, and the election is non-preemptive, so a new higher-priority router will not displace a sitting DR. From R3’s side the same command confirms the mirror image, with R1 shown as a DROTHER:
Neighbor ID Pri State Dead Time Address Interface
1.1.1.1 1 FULL/DROTHER 00:00:36 10.0.0.1 GigabitEthernet0/0
2.2.2.2 1 FULL/BDR 00:00:37 10.0.0.2 GigabitEthernet0/0
The link-state database
The LSDB is where OSPF keeps its map, and show ip ospf database prints it. For CCNA, two LSA types matter on a single-area broadcast network. Every router originates a router LSA (Type 1) describing its own links, and the DR originates a network LSA (Type 2) representing the shared segment:

Under Router Link States there is one entry per router (1.1.1.1, 2.2.2.2, 3.3.3.3). Under Net Link States there is a single network LSA whose advertising router is 3.3.3.3, the DR, with the DR’s interface address 10.0.0.3 as the Link ID. That is the proof that the DR represents the segment in the database. Every router in the area holds this same LSDB; the routing table each one builds from it can differ, but the database does not.
Cost: how OSPF picks the best path
OSPF’s metric is cost, calculated as a reference bandwidth divided by the interface bandwidth, with a default reference of 100 Mbps and a minimum cost of 1. Because of that default, Fast Ethernet and everything faster all come out as cost 1, which is why production networks raise the reference bandwidth to tell a 1 Gbps link apart from a 10 Gbps one. The routes OSPF computes appear in the table with an O code and the [110/cost] bracket:
show ip route ospf
R1 learns the loopbacks of the other two routers, each at cost 2 (cost 1 to leave R1’s Gigabit Ethernet interface, plus cost 1 for the loopback at the far end) and OSPF’s administrative distance of 110:
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/2] via 10.0.0.2, 00:00:29, GigabitEthernet0/0
3.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/2] via 10.0.0.3, 00:00:39, GigabitEthernet0/0
The 110 is OSPF’s administrative distance, so an OSPF route loses to a static route (distance 1) for the same prefix but beats RIP. Once the route is installed, the router forwards along it exactly as the packet forwarding process describes.
Router ID, areas, and timers
A few smaller pieces tie the rest together. The router ID is a 32-bit identifier chosen once at startup: an explicit router-id if configured, otherwise the highest IP on an up loopback, otherwise the highest IP on an up physical interface. Loopbacks are preferred because they never go down. Areas limit how far LSAs flood; single-area OSPF puts every router in area 0, the backbone, which is the focus for CCNA. The hello and dead timers, 10 and 40 seconds on a broadcast segment, are the heartbeat: miss four hellos and the neighbor is declared dead. All of these are visible in the show ip ospf and show ip ospf interface output above.
Practice on your own lab
Paste-ready configurations for all three routers are in the ccna-labs repository. Build the three routers on one switch, let the adjacencies form, then run show ip ospf neighbor, show ip ospf interface, and show ip ospf database and watch the DR election and the LSDB for yourself. The CCNA 200-301 study roadmap shows where OSPF sits in Domain 3, which is the heaviest scoring block on the exam.
What to check first when an OSPF neighbor will not come up
Most OSPF problems are neighbor problems, and they come from a short list of mismatches. The hello and dead timers must match on both ends. Both interfaces must be in the same area and the same subnet and mask. An interface set to passive sends no hellos at all, so it forms no neighbor. An MTU mismatch lets the routers reach the ExStart or Exchange state and then stick there, which is a classic trap because the neighbor looks half-formed rather than absent. Authentication, if configured, has to agree. Run show ip ospf neighbor to see whether an adjacency exists and at what state, then show ip ospf interface to compare the area, network type, and timers between the two sides. Nearly every stuck adjacency traces back to one of those, and reading the two outputs side by side is faster than guessing.