OSPF DR/BDR Election explained

Hi,

I have a question, In the process of election DR/ BDR, who will elect first? DR or BDR ?
I have only one router in my setup. I configured OSPF on that router and I started debug message. After the end of wait period ( dead interval 40 sec), router considers himself as BDR and then moved to DR .
please explain me, in the election process, will BDR is elected first or DR ?

Below is the debug message:

 R1#
    *Mar  1 00:01:12.207: %SYS-5-CONFIG_I: Configured from console by console
    R1#
    *Mar  1 00:01:18.215: OSPF: Send hello to 224.0.0.5 area 0 on FastEthernet0/0 from 100.100.100.1
    R1#
    *Mar  1 00:01:28.215: OSPF: Send hello to 224.0.0.5 area 0 on FastEthernet0/0 from 100.100.100.1
    R1#
    *Mar  1 00:01:38.215: OSPF: end of Wait on interface FastEthernet0/0
    *Mar  1 00:01:38.215: OSPF: DR/BDR election on FastEthernet0/0
    *Mar  1 00:01:38.215: OSPF: Elect BDR 13.1.1.1
    *Mar  1 00:01:38.215: OSPF: Elect DR 13.1.1.1
    *Mar  1 00:01:38.215: OSPF: Elect BDR 0.0.0.0
    *Mar  1 00:01:38.215: OSPF: Elect DR 13.1.1.1
    *Mar  1 00:01:38.215:        DR: 13.1.1.1 (Id)   BDR: none
    *Mar  1 00:01:38.215: OSPF: Send hello to 224.0.0.5 area 0 on FastEthernet0/0 from 100.100.100.1
    R1#
    *Mar  1 00:01:48.215: OSPF: Send hello to 224.0.0.5 area 0 on FastEthernet0/0 from 100.100.100.1
    R1#

Azeem,
The BDR is elected first (see step #7 below). Here is a break down of what happens during the election:

  1. Once an OSPF becomes active on a multi-access network, it sets the DR and BDR values to 0.0.0.0 which indicates these are unknown. It also starts a wait timer of the value of the dead interval.
  2. The router starts neighbor discovery. It sends the 0.0.0.0 values for DR/BDR
  3. If a received Hello includes values for DR/BDR, these are accepted and the wait timer is stopped
  4. If the wait timer expires, the DR election starts
  5. A list of neighbors on the multiaccess network is established that are eligible for being DR/BDR (their priority is higher than zero)
  6. A subset of routers from this list is created. This subset excludes routers listing their own address as the DR (so routers claiming to be the DR are excluded)
  7. From this subset, select the router with the highest priority/RID/Loopback/Address to be the BDR
  8. From the original (not subset list), select the Router with the highest priority/RID/loopback/address to be the DR
  9. If there are no routers originally claiming to be the DR, then promote the chosen BDR to a DR, and elect another BDR via the same method
1 Like

Hi Andrew,

Thanks for explaining in step by step.

-Azeem

Hi Rene,

Thanks for sharing your knowledge. Your teaching gives us a great confidence.

I have a doubt. Among DR and BDR, who is elected first ?

Regards,
David

David,

The BDR is elected first (see step 7 below). Here is a detailed list of what happens in the DR/BDR election:

  1. Once an OSPF becomes active on a multi-access network, it sets the DR and BDR values to 0.0.0.0 which indicates these are unknown. It also starts a wait timer of the value of the dead interval.
  2. The router starts neighbor discovery. It sends the 0.0.0.0 values for DR/BDR
  3. If a received Hello includes values for DR/BDR, these are accepted and the wait timer is stopped
  4. If the wait timer expires, the DR election starts
  5. A list of neighbors on the multiaccess network is established that are eligible for being DR/BDR (their priority is higher than zero)
  6. A subset of routers from this list is created. This subset excludes routers listing their own address as the DR (so routers claiming to be the DR are excluded)
  7. From this subset, select the router with the highest priority/RID/Loopback/Address to be the BDR
  8. From the original (not subset list), select the Router with the highest priority/RID/loopback/address to be the DR
  9. If there are no routers originally claiming to be the DR, then promote the chosen BDR to a DR, and elect another BDR via the same method

Hey Andrew,

Thanks a lot for the response. Well explained.

Regards

19 posts were merged into an existing topic: OSPF DR/BDR Election explained

Hi Andrew, Hi all.

I reading the book of Doyle about the election of DR/BDR.
I don’t understand this point:

_“From the list of eligible routers, create a subset of all routers not claiming to be the DR (routers declaring themselves to be the DR cannot be elected BDR)”._

**Why a router, after becomes active should not declare itself as DR?**

I know that all router declaring themselves to be DR and BDR in their Hello packet.

I think that the quotation from the book is possible only when a router become active on BMA segment alredy existing where there is already a DR router.

But, for exemple in the case of a new BMA topology where all routers become active on the same time?
Each of them, after the first Hello packet with 0.0.0.0 in DR/BDR fields, set itself as DR and BDR after heard the firt incoming neighbor’s hello packet? Correctly?

Therefore, How a router can build a subset of routers not claiming to be DR?

After, the book said:

_“If no router in the subset claims to be the BDR, the neighbor with the highest priority will become the BDR. In a tie, the neighbor with the highest Router ID will be chosen”._

In conclusion, I understand from the book that before there is election of BDR and after of the DR.
But I don’t understand the case of a new BMA segment where all routers boot up together and claim to be DR and BDR.

In this case, I should see the router with highest ID as BDR and the second highest as DR ( BDR election first, and after DR election ).

Thanks a lot in advice.

Americo

Hello Americo

When we have a BMA situation, and all routers boot up together, ALL routers declare that they are the DR. So at the beginning, the subset of all routers not claiming to be the DR is an empty set. There are NO routers in this subset. So initially, this list of eligible routers will be empty. As hello packets are exchanged however, routers will receive the priority and router IDs and any routers ineligible to be a DR will CHANGE that information in the next hellos.

Now if a router creates a subset of all routers not claiming to be the DR, then this subset is non zero. It all depends on WHEN that subset will be created. Don’t forget that the DR and BDR election process is an iterative process as the network converges and even when network changes occur. At some point, routers some will stop declaring themselves DRs and the process can continue as described.

A clearer albeit dryer explanation of the election process can be found at RFC 2328 for OSPFv2 in seciton 9.4 Electing the Designated Router. It is true that the BDR is elected first and then the DR. The RFC explains why:

The reason behind the election algorithm’s complexity is the
desire for an orderly transition from Backup Designated Router
to Designated Router, when the current Designated Router fails.
This orderly transition is ensured through the introduction of
hysteresis: no new Backup Designated Router can be chosen until
the old Backup accepts its new Designated Router
responsibilities.

This can be clearly seen in the case where the current DR fails and the election process is repeated (per step (4) in section 9.4 of RFC) the router it elected to BDR and DR is no longer eligible for BDR (because it is DR), and so the “correct” BDR is elected.

I hope this has been helpful!

Laz

1 Like

I read in this forum post the name Doyle mentioned in regards to a question answered by Andrew who had posted information that looked like it may have referenced a book series by Doylel so I thought if experts might be using this as a reference book it might be worth looking into. I did some digging and found the two volume set on amazon. After reading some of the references on amazon people compared this as the holy bible of networking reference book (albeit a very granular and specific area, meaning specific to routing protocols not a guide to cover all material or passing a specific test) Is it true this is a set that most network engineers should have in their arsenal? Now my eye sight is not the best so I prefer kindle on my large monitors (getting older its large monitors and reading glass on smaller devices lolo)

Anyway I am really thinking about purchasing these two books not really just for study (I am not even studying for CCIE yet) but for reference book on routing protocols for if I happen to want to see something very granular any thoughts or input on these the books or material?

Routing TCP/IP, Volume 1 (CCIE Professional Development) 2nd Edition, Kindle Edition

Routing TCP/IP, Volume II: CCIE Professional Development: CCIE Professional Development: 2

Hi all,

I just want to check my reasoning here and make I am clear on what I think I know:
image

Now R1 sees R2 and R3 each as a DR and that is because they are not on a shared segment. If I do the following I see:

R1#sh ip ospf int fa0/0
FastEthernet0/0 is up, line protocol is up
  Internet Address 10.0.12.1/24, Area 0
  Process ID 1, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 10
  Transmit Delay is 1 sec, State BDR, Priority 1
  **Designated Router (ID) 2.2.2.2, Interface address 10.0.12.2**
  **Backup Designated router (ID) 1.1.1.1, Interface address 10.0.12.1**

R1#sh ip ospf int fa0/1
FastEthernet0/1 is up, line protocol is up
  Internet Address 10.0.13.1/24, Area 0
  Process ID 1, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 10
  Transmit Delay is 1 sec, State BDR, Priority 1
  **Designated Router (ID) 3.3.3.3, Interface address 10.0.13.3**
**Backup Designated router (ID) 1.1.1.1, Interface address 10.0.13.1**

It seems very much to be a point of view thing. Because from R3’s perspective:

R3#sh ip ospf int fa0/0
FastEthernet0/0 is up, line protocol is up
  Internet Address 10.0.23.3/24, Area 0
  Process ID 3, Router ID 3.3.3.3, Network Type BROADCAST, Cost: 10
  Transmit Delay is 1 sec, State DR, Priority 1
  **Designated Router (ID) 3.3.3.3, Interface address 10.0.23.3**
  **Backup Designated router (ID) 2.2.2.2, Interface address 10.0.23.2**

R3#sh ip ospf int fa0/1
FastEthernet0/1 is up, line protocol is up
  Internet Address 10.0.13.3/24, Area 0
  Process ID 3, Router ID 3.3.3.3, Network Type BROADCAST, Cost: 10
  Transmit Delay is 1 sec, State DR, Priority 1
  **Designated Router (ID) 3.3.3.3, Interface address 10.0.13.3**
  **Backup Designated router (ID) 1.1.1.1, Interface address 10.0.13.1**

So each router in area 0 has it’s own perspective of things. Does that make sense?

Thanks Mike!

After reading a bit more on the subject I guess I should more accurately say it’s from the view of the segment really and not the router.

Thanks
Mike

Hello Michael

Yes, this is very much the case. Remember that a DRs and and a BDRs are used specifically for multi-access networks, when there can be multiple OSPF routers ON THE SAME NETWORK SEGMENT/IP SUBNET. This means that a DR and a BDR will be elected for each network SEGMENT. In the above scenario, each network segment is composed of two routers. For the first segment (R1 and R2) one will be elected as DR and one as BDR. Similarly for R2-R3 and R3-R1.

One may say that these are point to point connections, so why are DRs and BDRs being elected? Because Ethernet is being used, and this is an inherently multi-access technology. If the connections were serial connections, no DR/BDR would be elected, because there can never be a third OSPF router in that subnet.

I hope this has been helpful!

Laz

Thanks Laz! Good to know I understand this correctly. :grinning:

1 Like

Hi i increased priority and cleared ospf process still DR is not changing

interface Ethernet0/0
 ip address 192.168.23.1 255.255.255.0
 ip ospf priority 200
R1#clear ip ospf process
Reset ALL OSPF processes? [no]: yes
*Mar  1 00:15:44.663: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.23.2 on Ethernet0/0 from FULL to DOWN, Neighbor Down: Interface down or detached
*Mar  1 00:15:44.663: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.23.3 on Ethernet0/0 from FULL to DOWN, Neighbor Down: Interface down or detached
*Mar  1 00:15:44.755: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.23.3 on Ethernet0/0 from LOADING to FULL, Loading Done
*Mar  1 00:15:44.771: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.23.2 on Ethernet0/0 from LOADING to FULL, Loading Done

R1#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
192.168.23.2      1   FULL/BDR        00:00:37    192.168.23.2    Ethernet0/0
192.168.23.3      1   FULL/DR         00:00:38    192.168.23.3    Ethernet0/0

I am still getting R3 as DR

R2#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
192.168.23.1    200   FULL/DROTHER    00:00:33    192.168.23.1    Ethernet0/0
192.168.23.3      1   FULL/DR         00:00:35    192.168.23.3    Ethernet0/0
R3#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
192.168.23.1    200   FULL/DROTHER    00:00:37    192.168.23.1    Ethernet0/0
192.168.23.2      1   FULL/BDR        00:00:30    192.168.23.2    Ethernet0/0

Please help me on this

Hello Pavan.

In order to get the routers to recynchronize their OSPF configurations, you must run clear ip ospf process on ALL routers. If you do it only on R1, then R3 maintains its status as DR. It doesn’t recheck to see if it is still DR.

Try it out again and let us know your results!

I hope this has been helpful.

Laz

I think at the middle of the page the example is wrong at this point:
Something you need to be aware of is that the DR/BDR election is per multi-access segment…not per area!). Let me give you an example: …

Based on the configuration that you provided, R2 should be the DR for both segments, because no priority configuration or loopback configuration is recorded, so the highest ipv4 addresses will determine the DR.

Hi Kristóf,

You are right, with the configs I supplied then R2 would be the DR on the left segment and R3 on the right segment. I just changed this. Thanks!

Rene

Hello Rene,

Just a quick question please, why DR and BDR roles didn’t include master and slave, in other words why do we have to have a separate roles for master and slaves beside DR and BDR

Thanks

Hello Said

The DR/BDR elections are two different and somewhat independent processes. In the event that there is a point to point connection, the DR/BDR elections don’t take place, but a master/slave relationship must be determined for the neighbour relationship that exists over that link. This election essentially states who initiates communication.

Now in the case of a multiaccess network such as Ethernet, a DR/BDR election takes place first, then the Master/Slave election. Because these are separate processes, it is possible for the the DR/BDR to become master or some other switch to become master, and both cases would be acceptable. Who initiates the exchange of LSAs (master) is independent of who plays the role of DR/BDR.

I hope this has been helpful!

Laz