In 20 years, you will be more dissapointed by what you didn't do than by what you did.

OSPF DR/BDR Election Explained: Priority, Router ID and Failover

OSPF DR/BDR election is a common interview trap: the router with the highest priority does not necessarily replace the router already acting as DR. Existing roles and the order in which routers join matter.[1]

Short answer: OSPFv2 elects a Designated Router (DR) and Backup Designated Router (BDR) on broadcast and NBMA networks, not on point-to-point links. Among otherwise comparable eligible candidates, higher interface priority wins, then higher router ID; priority zero excludes a router from both roles. A late-arriving higher-priority router does not preempt an established DR or BDR.[1]

What do the DR and BDR actually do?

The DR coordinates link-state flooding on a shared network and originates its Type-2 network LSA. The BDR maintains adjacencies so it can take over when the DR fails. These are roles on a particular network segment, not a single elected leader for the whole OSPF area.[1]

A DR is not a mandatory transit router for user packets. The election organizes OSPF control-plane communication; forwarding still follows the routing calculation and next hops.[1]

Our existing OSPF network-types guide compares the topology choices; this article concentrates on election order, non-preemption and failover rather than repeating that design overview.[2]

Broadcast vs point-to-point: when is there an election?

The following distinction comes from the OSPFv2 network and adjacency models.[1]

OSPF network type DR/BDR election? Expected adjacency pattern
Broadcast Yes DROthers become Full with DR/BDR, but remain 2-Way with other DROthers
NBMA Yes Same DR/BDR-based adjacency model; neighbor discovery needs separate consideration
Point-to-point No The two routers form a full adjacency when exchange succeeds
Point-to-multipoint No Full adjacency with directly connected OSPF neighbors

The configured OSPF network type matters, not simply whether the cable is Ethernet. Two routers can still elect a DR and BDR if their link operates as OSPF broadcast.[1]

Election flow: more than sorting router IDs

This is a practical reading of RFC 2328 section 9.4, not a replacement for its full state machine.[1]

  1. Discover candidates through Hellos. The router considers itself and neighbors with bidirectional communication, meaning neighbor state at least 2-Way.[1]
  2. Remove priority-zero candidates. They can still participate in OSPF, but cannot become DR or BDR.[1]
  3. Calculate the BDR first. Exclude routers declaring themselves DR. Prefer candidates already declaring themselves BDR; otherwise select among the remaining candidates. Use highest priority and then highest router ID within the applicable candidate group.[1]
  4. Calculate the DR. Prefer routers already declaring themselves DR, resolving competing declarations by priority and router ID. If there is no declared DR, promote the newly selected BDR.[1]
  5. Repeat the calculation when the local role changes, then reevaluate adjacencies. This prevents the local router from settling into both roles.[1]

On startup, the interface's Waiting state gives routers time to discover the existing DR/BDR before election. The Wait Timer is not a periodic preemption timer; election-related events and existing declarations determine the result.[1]

Interview shortcut: “Highest priority, then highest router ID” describes candidate ranking, but is incomplete unless you also mention priority zero, existing roles and non-preemption.[1]

Worked example: a stronger router joins late

This is an illustrative lab scenario, not captured device output. Assume R1 and R2 have already completed election on one broadcast VLAN and R1 is DR. R3 and R4 join afterward.

Router Example router ID Interface priority Role after joining the stable segment
R1 192.0.2.11 100 Existing DR
R2 192.0.2.12 50 Existing BDR
R3 192.0.2.13 200 DROther despite higher priority
R4 192.0.2.14 0 DROther; ineligible for DR/BDR

These predicted roles follow the existing-role preference in the election algorithm.[1]

If R1 fails and its loss is detected, R2 transitions from BDR to DR; R3 becomes the replacement BDR in this scenario. R3 does not jump ahead of the existing BDR merely because its priority is higher.[1]

If R1 later returns with the same configuration, it does not reclaim DR automatically. It joins the now-established DR/BDR arrangement as a DROther.[1]

Lab exercise: record roles before adding R3, after adding it, after isolating R1, and after restoring R1. Compare the observations with the predictions above. Perform failure testing only in an isolated lab or an approved maintenance window.

Why 2-Way can be healthy

On a broadcast segment, two DROthers normally remain at 2-Way with each other. Both synchronize fully with the DR and BDR; making every pair Full is not the intended model.[1]

For the example before R1 fails, inspect the following expected relationships, assuming database exchange has completed successfully.[1]

  • R3 to R1: Full, with R1 acting as DR.
  • R3 to R2: Full, with R2 acting as BDR.
  • R3 to R4: 2-Way, because both are DROthers.

If the expected DR/BDR adjacency is stuck in ExStart or Exchange, election may already be working: troubleshoot database exchange rather than changing election priority. The protocol separates the decision to form an adjacency from database synchronization.[1]

Practical verification checklist

On Cisco IOS/IOS XE-style devices, these are useful read-only checks; command availability and displayed fields vary by release:

show ip ospf interface GigabitEthernet0/0
show ip ospf neighbor
show ip ospf database network
show ip protocols

Use this workflow rather than resetting the routing process immediately:

  1. Confirm the interface's actual OSPF network type and area.
  2. Record the local interface role, priority, router ID and displayed DR/BDR addresses.
  3. Compare the same information on the other routers attached to the segment.
  4. Check which routers joined first and whether a DR/BDR was already established.
  5. Confirm which neighbor pairs should be Full and which should remain 2-Way.
  6. Inspect Hellos in an authorized packet capture if the views disagree.

In an OSPFv2 Hello, the DR and BDR fields contain their interface IP addresses on the network, not necessarily their router IDs. Router priority and the current DR/BDR declarations are carried in Hello packets.[1]

A Cisco-style lab configuration for an interface that should never become DR or BDR is:

interface GigabitEthernet0/0
 ip ospf priority 0

Treat this as a configuration example, not a live change recommendation. Plan eligibility before bringing up the segment; do not assume changing priority will immediately transfer an existing DR role. Verify the resulting behavior on your platform, and avoid a production-wide OSPF process reset just to obtain a preferred election outcome.

Common pitfalls

  • “Lowest priority wins, like STP.” OSPF favors higher priority among comparable candidates; zero means ineligible.[1]
  • “The router ID always decides.” Priority is evaluated first; router ID breaks a tie within the applicable candidate set.[1]
  • “The BDR does nothing until failure.” It maintains full adjacencies with the segment's other routers so that takeover does not start from scratch.[1]
  • “All routers at priority zero is fine on broadcast.” No router is eligible, so there is no DR/BDR to establish the intended shared-network adjacencies.[1]
  • “DR selection chooses the fastest data path.” It organizes adjacency and flooding, not a mandatory forwarding hub.[1]
  • “An interface marked point-to-point still needs a BDR.” That OSPF network type has no DR/BDR election.[1]

A concise interview answer

“OSPF elects a DR and BDR per broadcast or NBMA segment to organize adjacencies and link-state flooding. Priority zero makes a router ineligible; otherwise higher priority and then higher router ID rank candidates. Existing declarations matter, so a higher-priority newcomer does not preempt the current roles. When the DR fails, the BDR takes over. DROthers normally remain 2-Way with each other but become Full with the DR and BDR. Point-to-point links do not use this election.”[1]

Related reading

Summary

Remember network type → eligibility → existing roles → priority → router ID, and explain why a healthy broadcast segment can contain 2-Way neighbors.[1]

Preparing for a network engineering interview? Rehearse the late-joining-router example aloud, then reproduce it in a lab and explain each role change without looking at your notes.

Sources

Comments

0 Responses to "OSPF DR/BDR Election Explained: Priority, Router ID and Failover"

Post a Comment

Popular Posts