Octet

Why does OSPF elect a DR and BDR, and how is the election decided?

Show the answer

Say this first

On a multi-access segment with n routers, a full mesh of adjacencies would be n(n-1)/2 and every change would flood n times. Instead every router goes Full only with the DR and BDR, and the DR originates one Type 2 LSA for the segment. Highest priority wins (default 1, 0 means never), then highest router ID.

Go deeper

The rules

  • Runs on broadcast and NBMA network types only. Not on point-to-point or point-to-multipoint.
  • Priority is per interface, 0 to 255, default 1. Priority 0 means the router can never be DR or BDR.
  • Tie on priority: highest router ID wins.
  • The BDR is elected first, then the DR. If there is no DR, the BDR is promoted.
  • A router that comes up on a segment waits the wait timer (equal to the dead interval, 40 seconds) before it elects, so it can learn about an existing DR first.

Influencing it

Cisco IOS
interface GigabitEthernet0/0/0
 ip ospf priority 255

On the routers that should never be DR, such as small branch routers on a shared WAN segment, I set ip ospf priority 0.

What you see

Output
R3# show ip ospf neighbor
Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1.1         255   FULL/DR         00:00:36    10.0.123.1      GigabitEthernet0/0/0
2.2.2.2           1   FULL/BDR        00:00:39    10.0.123.2      GigabitEthernet0/0/0
4.4.4.4           1   2WAY/DROTHER    00:00:33    10.0.123.4      GigabitEthernet0/0/0

R3 is a DROTHER. It is Full with the DR and BDR and stays 2WAY with R4, the other DROTHER.

Traps

  • Saying the highest IP address wins. It is highest priority, then highest router ID.
  • Saying the DR is the "router with the most routes". The DR only matters for flooding on that segment.
How did you do?