OSPF explained: states, DR/BDR and cost

Updated October 9, 2026

OSPF in one paragraph

OSPF (Open Shortest Path First) is a link-state routing protocol: every router in an area builds the same map of the network, called the link-state database, and each router runs the shortest path algorithm on it to choose routes by lowest total cost. Two routers exchange routes only after they become neighbors and then fully adjacent, so nearly every OSPF exam question is really about what has to match for that to happen and where the process stalls. The decision rule: if the neighbor is missing or stuck, compare the settings that must match; if the route is wrong, add up the interface costs.

The protocol is defined in RFC 2328 (OSPFv2, for IPv4). It runs directly over IP as protocol number 89, not over TCP or UDP, and sends Hellos to the multicast address 224.0.0.5.

The path to Full, state by state

A neighbor relationship moves through a fixed sequence. Knowing what each state means turns “stuck in X” questions into a one-step lookup. The states below follow Cisco’s description of OSPF neighbor states and RFC 2328.

StateWhat has happenedIf it stays here
DownNo Hello received yetInterface down, OSPF not enabled on the interface, or Hellos blocked
InitA Hello arrived, but it does not list this router’s IDHellos flow only one way: ACL, or a one-sided configuration problem
2-WayEach router sees its own ID in the other’s HelloNormal between two DROthers on a broadcast segment
ExStartRouters pick primary and secondary roles and an initial sequence numberOften an MTU mismatch, or a duplicate router ID
ExchangeDatabase description packets list the LSA headers each side holdsSame causes as ExStart
LoadingMissing LSAs are requested and sentCorrupt or filtered updates; rare
FullDatabases are synchronisedNormal operating state

The first state is easy to misread. On a broadcast network such as Ethernet, routers reach Full only with the DR and BDR. Two ordinary routers stay in 2-Way with each other permanently, and that is correct, not a fault. On a point-to-point link, neighbors go all the way to Full.

What must match for a neighbor to form

Hellos are sent every 10 seconds on Ethernet and point-to-point links in Cisco IOS, with a dead interval of 40 seconds (four times the Hello interval by default). Non-broadcast links default to 30 and 120. A router that hears nothing for the dead interval declares the neighbor down. These must match on both ends of the link:

  • Area ID
  • Subnet and mask (on a broadcast segment)
  • Hello and dead intervals
  • Authentication settings
  • Stub area flags

Two more problems do not prevent the Hello exchange but break the adjacency later: a different MTU on the two interfaces (the database exchange stalls in ExStart or Exchange; Cisco has a dedicated troubleshooting document for this) and two routers with the same router ID. The router ID comes from the configured router-id, otherwise the highest IPv4 address on an up loopback, otherwise the highest address on an up physical interface.

Worked example: R1 and R2 share 10.1.1.0/24. show ip ospf neighbor on R1 shows R2 in INIT. R1 has seen R2’s Hello, but R2 has not seen R1’s, so look for something dropping traffic from R1 to R2, such as an ACL, rather than for an MTU problem. A timer, area or mask mismatch shows differently: the Hellos are discarded and the neighbor never appears at all. If it had said EXSTART, the MTU would be the first thing to compare in show ip ospf interface.

DR and BDR election

On a multi-access segment, having every router form a full adjacency with every other would create too many adjacencies and too much flooding. OSPF elects a Designated Router to which all others send their updates, and a Backup Designated Router to take over if the DR fails. Routers that are neither are DROthers. The rules:

  1. Highest OSPF interface priority wins. The default is 1, the range is 0 to 255.
  2. A tie goes to the highest router ID.
  3. Priority 0 means the router can never become DR or BDR.
  4. The election is not preemptive. A router that joins later does not displace an existing DR, even with a higher priority. To change the DR, clear the OSPF process on the current DR, or set priorities before the routers start.

DR and BDR listen on 224.0.0.6; DROthers send updates there and the DR floods them to 224.0.0.5. No election takes place on point-to-point links.

Cost: the arithmetic

Cost = reference bandwidth divided by interface bandwidth. The default reference bandwidth in Cisco IOS is 100 Mbps, so a 10 Mbps interface has cost 10 and anything at 100 Mbps or faster has cost 1. The route’s metric is the sum of the costs of the outgoing interfaces along the path. Because Fast Ethernet, Gigabit and 10 Gigabit all score 1 by default, modern networks change the reference bandwidth with auto-cost reference-bandwidth in the OSPF process. It has to be set to the same value on every router, or the routers will disagree about the best path. An explicit ip ospf cost on an interface overrides the calculation.

With a reference of 10000 Mbps, Gigabit costs 10, 10 Gigabit costs 1 and 100 Mbps costs 100.

Areas, ABRs and what the CCNA stays away from

Areas limit how much of the topology each router has to hold. Area 0 is the backbone and every other area must connect to it. A router with interfaces in more than one area is an ABR; a router that injects routes from outside OSPF, for example from a static route or another protocol, is an ASBR. The CCNA concentrates on single-area OSPFv2; version 2.0 of the exam (from February 3, 2027) adds the same ideas in OSPFv3 for IPv6. Multi-area design appears only as vocabulary.

Which exams test this

ExamHow the topic appearsWhere on this site
CCNA 200-301v1.1 (until Feb 2, 2027): IP Connectivity, objective 3.4, configure and verify single-area OSPFv2 (neighbor adjacencies, point-to-point, broadcast DR/BDR selection, router ID). v2.0 (from Feb 3, 2027): IP Routing, objective 3.3, the same items for single-area OSPFv2 and OSPFv3, with authentication excludedIP routing explained
CompTIA Network+ N10-009Network Implementation, objective 2.1: OSPF named among the dynamic routing protocols, next to BGP and EIGRP, with route selection by administrative distance, prefix length and metricNetwork implementation explained covers link-state versus distance vector routing; CCNA vs Network+ compares the depth

How OSPF questions are built

The questions give a topology and a symptom, and the answer is one mismatched parameter. The words that decide it: “stuck in EXSTART” points to MTU, “stuck in INIT” to one-way Hellos, “2-WAY between two routers on Ethernet” is normal, “after a new router with higher priority was added” means the DR did not change. Cost questions hide the trick in the reference bandwidth: check whether it was changed before summing.

Practice questions

Question 1. Two routers are connected by a Gigabit Ethernet link. R1 shows R2 in the EXSTART state indefinitely, and the Hello and dead timers, area ID and mask all match. Which cause should be checked first?

  • A. The interface MTU differs on the two routers
  • B. The Hello interval differs on the two routers
  • C. The OSPF priority differs on the two routers
  • D. A firewall blocks TCP port 89 between the routers
Show answer

Answer: A

Neighbors that exchange Hellos successfully and then stall in ExStart or Exchange usually have different interface MTUs, because the large database description packets from one router are dropped by the other. A mismatched Hello interval makes each router discard the other’s Hellos, so the neighbor would not appear at all, and the timers are stated to match. Priority only affects the DR election, which happens after 2-Way. OSPF does not use TCP, so there is no port to block.

Question 2. On every router the reference bandwidth was set to 10000 Mbps. R1 can reach 192.0.2.0/24 over path X, three Gigabit Ethernet links, or path Y, one 10 Gigabit Ethernet link followed by one 100 Mbps link. Which path does R1 use?

  • A. Path Y, because it has fewer hops
  • B. Both paths equally, because the costs are equal
  • C. Path Y, because it contains the fastest link
  • D. Path X, with a total cost of 30
Show answer

Answer: D

With a reference of 10000 Mbps, a Gigabit link costs 10, a 10 Gigabit link costs 1 and a 100 Mbps link costs 100. Path X totals 30 and path Y totals 101, so R1 uses path X. With the default reference of 100 Mbps every link here would cost 1, path X would total 3 and path Y 2, so the default would favour Y; that is the trap. The paths are not equal, and OSPF chooses by total cost, not by hop count or by the single fastest link.

Go deeper