skip to content

How does OSPF elect a Designated Router and Backup Designated Router on a LAN, and why doesn't a higher-priority newcomer take over?

level: middleimportance: must knowfreq 45%

answer

  1. only on multi-access network types
  2. priority first, then Router ID
  3. zero means never eligible
  4. BDR elected before DR
  5. stability over optimality

basics

~20 s

On broadcast and NBMA networks, OSPF elects a BDR, then a DR, from routers in 2-Way or above: highest Router Priority wins, highest Router ID breaks ties, priority 0 never qualifies. A better newcomer never preempts a working DR.

solid answer

~50 s

Only broadcast and NBMA networks elect a DR; point-to-point, Point-to-MultiPoint and virtual links do not. A router whose interface comes up first sits in the `Waiting` state for `RouterDeadInterval`, listening to Hellos, unless a neighbour already announces itself as BDR. Then RFC 2328's algorithm runs: among routers in 2-Way or above with nonzero priority, pick the BDR, preferring routers already declaring themselves BDR, by highest Router Priority then highest Router ID; then pick the DR the same way from routers declaring themselves DR, or promote the new BDR if none does. Because routers that already hold a role keep it, a newcomer with priority 255 does not displace a working DR or BDR. That is deliberate: the DR stands for the LAN in the link-state graph, so changing it makes routers originate new LSAs and can briefly disrupt traffic. When the DR fails, the BDR takes over and a new BDR is elected.

go deeper

for a junior

Know that a LAN running OSPF elects a DR and BDR, that the highest priority wins, and that 0 means never.

for a middle

Walk the election: Waiting, BDR first, highest priority then highest Router ID, and why an existing DR is not preempted.

for a senior

Plan priorities so the intended routers win regardless of boot order, keep weak or partially connected routers at 0, and predict what a DR failure costs.

for a principal

Judge where a broadcast segment with a DR is worth having at all versus point-to-point links, weighing adjacency count against failover behaviour.

## Why a DR exists On a LAN with many OSPF routers, letting every pair synchronise its databases would mean a full mesh of adjacencies and duplicated flooding. RFC 2328 instead elects a **Designated Router (DR)**. The DR does two jobs: it **originates the network-LSA** that represents the LAN as a single node in the area's map, and it **becomes adjacent to every other router** on the LAN, so database synchronisation runs through it. A **Backup Designated Router (BDR)** is also adjacent to everyone, so it can take over without building new adjacencies. The DR is a control-plane role only: data packets between two routers on the LAN go directly between them. ## Which network types elect one | OSPF network type | DR and BDR? | Who becomes adjacent | |---|---|---| | Broadcast (for example Ethernet) | yes | every router with the DR and BDR | | NBMA (non-broadcast multi-access) | yes | every router with the DR and BDR | | Point-to-point | no | the two routers, always | | Point-to-MultiPoint | no | every pair that can talk directly | | Virtual link | no | the two endpoints, always | ## The election step by step When an interface to a broadcast or NBMA network comes up and the router is eligible, the interface enters the **`Waiting`** state and starts a Wait Timer of `RouterDeadInterval` seconds. It listens to Hellos to learn whether a DR and BDR already exist. The wait ends early with the `BackupSeen` event, raised when a neighbour declares itself BDR, or declares itself DR while naming no BDR. Then RFC 2328 section 9.4 runs: 1. Build the candidate list: this router plus every neighbour in **2-Way or above**, minus any router with **Router Priority 0**. 2. **Elect the BDR** from candidates that are *not* declaring themselves DR. If some are already declaring themselves BDR, choose among those only. The winner has the **highest Router Priority**; ties go to the **highest Router ID**. 3. **Elect the DR** from candidates declaring themselves DR, by the same rule. If none does, the newly elected BDR becomes DR. 4. If this router's own role just changed, repeat steps 2 and 3, so no router ends up as both DR and BDR. 5. Set the interface state to `DR`, `Backup` or `DR Other`, and re-check adjacencies with the `AdjOK?` event. Router Priority is an 8-bit unsigned field, so values run from 0 to 255. ## No preemption, and why The rule that **existing declarations win** is the reason a newcomer does not take over. RFC 2328 says a router whose interface comes up and finds a DR **accepts it regardless of its own priority**. The cost of changing the DR is real: in the area's graph the LAN is a node labelled by its DR's interface address, so a new DR looks like a brand-new network node. Every attached router must originate new LSAs, and until databases converge again there can be a short loss of connectivity. RFC 2328 therefore wants the DR to change only rarely. It even notes that the elected DR may not be the router with the highest priority, and that the BDR may not have the second highest. The practical consequence is that **boot order decides** unless you plan priorities: set a high priority on the routers you want as DR and BDR, and priority 0 on routers that should never hold the role. ## When the DR fails 1. The other routers stop hearing its Hellos and, after `RouterDeadInterval`, declare it Down. 2. The election runs again. The BDR is still declaring itself BDR, and nobody now declares DR, so the BDR is promoted to DR. 3. A new BDR is elected from the remaining routers. 4. Because the old BDR was already Full with every router, no new database exchange is needed for the new DR; the disruption lasts about as long as it takes to flood the new LSAs. The BDR does not originate a network-LSA while it waits; RFC 2328 calls this a trade-off between database size and convergence speed. ## Design notes - A router that cannot reach every other router directly, such as a spoke on a partial-mesh NBMA network, should get priority 0. - If every router on a LAN has priority 0 there is no DR, and no adjacencies form on that LAN at all. - Re-running the election by restarting OSPF on the DR is disruptive; doing it to put a preferred router in place is a maintenance-window action.

  • In OSPF, what happens on a LAN when the Designated Router fails?
    After the dead interval the other routers declare it Down and rerun the election. The BDR, still declaring itself BDR, is promoted to DR, and a new BDR is elected from the rest. Because the old BDR was already Full with every router, no new database exchange is needed; the new DR originates the network-LSA and traffic is disrupted only for as long as the new LSAs take to flood.
  • Why would you give an OSPF router a Router Priority of 0?
    Priority 0 makes a router ineligible to be DR or BDR on that network. It suits a router with little control-plane capacity, or a spoke on a partial-mesh NBMA network that cannot reach every other router directly. The router still forms adjacencies with whichever routers are DR and BDR; it simply never holds the role.
  • How do you move the OSPF DR role to a preferred router without waiting for a failure?
    Raise the preferred router's priority, then make the current DR and BDR give up their roles, typically by resetting OSPF on their interfaces to that LAN, so a fresh election runs. That deliberately triggers the LSA churn the no-preemption rule avoids, so it belongs in a maintenance window, not in normal operation.

saying these in an interview costs you the question

  • The OSPF router with the lowest Router ID becomes the DR.
  • A higher-priority router immediately preempts the current OSPF DR when it joins.
  • An OSPF Router Priority of 0 means the most preferred router.
  • OSPF point-to-point links elect a DR just as Ethernet segments do.
  • The OSPF DR forwards all the data traffic between routers on the LAN.
  • The BDR originates its own network-LSA alongside the DR.