A real-life situation
Four routers connect to the same core switch on one VLAN, subnet 10.0.0.0/24. If every router became fully adjacent with every other router, you would have 6 adjacencies. With 10 routers it would be 45, and every change would be flooded to every router by every router. OSPF avoids that on shared Ethernet segments by electing a designated router. Then you notice something odd: two of the routers stay in the 2WAY state with each other forever. That is not a fault. This lesson explains why.
You should already know how neighbours form, covered in OSPF neighbours and adjacencies.
- 1. Everyone hears everyone. A hello to 224.0.0.5 reaches all three other routers, so each router has three neighbours on this segment.
- 2. R3 (a DROther) reports a change only to the DR and BDR. 224.0.0.6 is the all-DR-routers address. Only R1 (DR) and R2 (BDR) listen to it.
- 3. R1 (the DR) floods it to everyone. The DR resends the update to all OSPF routers. R4 learns about R3's change from R1, not from R3.
What the DR and BDR are
On a multi-access segment (one subnet where more than two routers can connect, like an Ethernet VLAN), OSPF elects:
- a DR (designated router): the central point that every router synchronises its database with,
- a BDR (backup designated router): ready to take over immediately if the DR fails,
- everyone else is a DROther.
DROthers become Full only with the DR and the BDR. Between two DROthers the relationship stops at 2-Way: they are neighbours (they see each other's hellos) but they do not swap databases directly.
| Routers on the segment | Full adjacencies without a DR (n × (n − 1) ÷ 2) | Full adjacencies with a DR and BDR |
|---|---|---|
| 4 | 6 | 5 |
| 10 | 45 | 17 |
| 20 | 190 | 37 |
With a DR and BDR, each of the other routers has two adjacencies, plus one between the DR and BDR themselves: 2 × (n − 2) + 1.
Why it works this way
The saving is not just the number of adjacencies. It is the flooding. Without a DR, a change seen by one router would be sent to every neighbour, each of which would acknowledge it and send it on to the others: many copies of the same update on one wire. With a DR there is one path in (to the DR and BDR) and one path out (from the DR to everyone).
The DR also describes the segment itself in the LSDB. It creates a network LSA (type 2) that lists every router on the subnet. Other routers then only need to say "I'm connected to this segment" instead of listing every other router on it.
The BDR exists so a failure does not start from zero. It is already Full with every router and listens to the same 224.0.0.6 updates, so when the DR dies it simply takes over.
How the election works
The election happens per segment, once the routers reach 2-Way. When an interface first comes up, the router waits for a wait timer (equal to the dead interval, 40 seconds by default) to hear whether a DR already exists, then:
No pre-emption is the part people forget. In practice the router whose OSPF process starts first often becomes DR, regardless of priority, simply because nobody else was there. If the DR fails, the BDR is promoted to DR and a new BDR is elected. The old DR, when it comes back, becomes a DROther.
How the router ID is chosen
The router ID breaks priority ties and names the router in every LSA, so it is worth controlling. When the OSPF process starts, IOS picks it in this order:
- the
router-idcommand underrouter ospf, - otherwise the highest IPv4 address on a loopback interface that is up,
- otherwise the highest IPv4 address on any other interface that is up.
The interface does not need to be running OSPF to be used. Once chosen, the router ID does not change by itself, even if you add a higher address or configure router-id. The new value is used only after the process restarts with clear ip ospf process or a reload. A loopback interface (a virtual interface that never goes down) is a common, stable source if you don't set it by hand.
OSPF network types
Whether a DR is elected depends on the interface's OSPF network type, which IOS chooses from the kind of interface:
| Network type | Default on | DR/BDR? | Hello / dead |
|---|---|---|---|
| Broadcast | Ethernet | Yes | 10 / 40 s |
| Point-to-point | Serial links with HDLC or PPP, tunnels | No | 10 / 40 s |
| Non-broadcast (NBMA) | Old Frame Relay style links | Yes | 30 / 120 s |
| Point-to-multipoint | Only when configured | No | 30 / 120 s |
The CCNA focuses on the first two. Here is the practical point: a link between two routers, like R1–R2 on 10.0.12.0/30 in the lab, is Ethernet, so it defaults to broadcast. OSPF runs a DR election on a link that can only ever hold two routers. Setting it to point-to-point skips the election and the 40-second wait, so the adjacency forms faster, and no type 2 LSA is needed for the link. That is why many networks configure ip ospf network point-to-point on router-to-router Ethernet links.
How to configure it on Cisco IOS
Goal on the shared segment: R1 should be DR and R2 the BDR, no matter which router boots first. R3 and R4 should never take either role.
! R1
interface GigabitEthernet0/0
ip ospf priority 100
! R2
interface GigabitEthernet0/0
ip ospf priority 50
! R3 and R4
interface GigabitEthernet0/0
ip ospf priority 0Priority is set per interface, so it only affects the election on that segment. Priority 0 takes R3 and R4 out of the election completely.
router ospf 1
router-id 1.1.1.1Set the router ID by hand on every router (2.2.2.2, 3.3.3.3, 4.4.4.4 on the others). If OSPF was already running, IOS warns that the new ID takes effect after a reload or clear ip ospf process.
R1# clear ip ospf process
Reset ALL OSPF processes? [no]: yesRestarts OSPF: every neighbour on the router drops and re-forms, so routes disappear briefly. Use it in a maintenance window. Because the election is not pre-emptive, new priorities may need this on the current DR and BDR before they take effect.
On the point-to-point lab link between R1 and R2:
! R1
interface GigabitEthernet0/1
ip ospf network point-to-point
! R2
interface GigabitEthernet0/0
ip ospf network point-to-pointConfigure both ends the same way. A mismatch (broadcast on one side, point-to-point on the other) causes routing problems.
How to verify it
R3#show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 1.1.1.1 100 FULL/DR 00:00:36 10.0.0.1 GigabitEthernet0/0 2.2.2.2 50 FULL/BDR 00:00:33 10.0.0.2 GigabitEthernet0/0 4.4.4.4 0 2WAY/DROTHER 00:00:38 10.0.0.4 GigabitEthernet0/0
R1#show ip ospf interface brief Interface PID Area IP Address/Mask Cost State Nbrs F/C Gi0/0 1 0 10.0.0.1/24 1 DR 3/3
DROTH and 2/3.R1#show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 2.2.2.2 0 FULL/ - 00:00:37 10.0.12.2 GigabitEthernet0/1
show ip ospf | include IDShows the router ID in use, for example: Routing Process "ospf 1" with ID 1.1.1.1
What goes wrong and how to troubleshoot it
- The "wrong" router is DR. Check the priorities with
show ip ospf interface, then remember the election is not pre-emptive. Restart OSPF on the current DR (and BDR) in a maintenance window. - No DR at all on a segment. If every router has priority 0, nobody can be DR, and the neighbours stay at 2-Way: no routes are exchanged on that segment.
- Network type mismatch. Broadcast on one end and point-to-point on the other. The timers still match (10/40), so the routers can reach Full, but they describe the link differently in their LSAs and routes over it may be missing. Check
show ip ospf interfaceon both ends forNetwork Type. - Router ID did not change. You configured
router-idbutshow ip ospfstill shows the old one: the process has not been restarted. - Duplicate router ID. Often caused by copying a configuration template. The router logs a duplicate router ID message and adjacencies fail.
Common mistakes
- Thinking the router with the highest priority always becomes DR. Only at election time; there is no pre-emption.
- Thinking the highest IP address on the segment decides the tie. It is the highest router ID.
- Reading 2WAY/DROTHER as a broken neighbour.
- Setting the priority in router configuration mode. It is an interface command:
ip ospf priority. - Expecting a DR on a serial point-to-point link, or forgetting that Ethernet links default to broadcast.
💡 Exam tip: expect a show ip ospf neighbor output and a question about which router is DR or BDR, or about what happens after a priority change (nothing until the next election). Know the tiebreakers (priority, then router ID), that priority 0 means "never DR", the router ID selection order (manual, loopback, physical), 224.0.0.5 vs 224.0.0.6, and that point-to-point links have no DR. Also know ip ospf network point-to-point.
Key takeaways
- On broadcast (Ethernet) segments OSPF elects a DR and BDR to cut down adjacencies and flooding.
- DROthers are Full with the DR and BDR and 2-Way with each other.
- Highest interface priority wins (default 1, 0 = never); ties go to the highest router ID. No pre-emption.
- Router ID:
router-idcommand, else highest up loopback, else highest up interface. Changes need a process restart. - Point-to-point networks have no DR; set router-to-router Ethernet links to point-to-point on both ends.
Check yourself
All four routers on a segment use the default priority. Their router IDs are 1.1.1.1, 2.2.2.2, 3.3.3.3 and 4.4.4.4, and they all start at the same moment. Which becomes DR?
R1 is the DR. You set R4's interface priority to 255. What happens right away?
On a DROther, show ip ospf neighbor lists another DROther in 2WAY/DROTHER. What should you do?
A router has loopback 10.255.255.1, Gi0/0 192.168.1.1 and Gi0/1 172.16.0.1, all up, and no router-id command. What is its OSPF router ID?
Two routers are connected by a serial link using PPP. How many DRs are elected on that link?