Enhance your Career in Networking With IPinBits!!!​

OSPF DR/BDR

Lets see how OSPF elects DR/BDR, how becomes DR, why BDR is elected first and the election process.

Significance of DR/BDR

  • As we are all aware, OSPF elects DR/BDR in the segment to reduce/control the LSA flooding.
  • This is to keep the ospf information flow (frequent exchange of LSA) centralized.
  • The Designated Router as well the backup Designated router are elected by the Hello Protocol.
  • On every multi-access segment OSPF has to elect DR and BDR.
  • All Routers forms full adjacency with DR and BDR, and two-way states with all other routers in that particular segment.

DR/BDR election is per multi-access segment…not per area !!!

Let’s consider the below case, all the routers are in suspend state for simplicity of understanding, and we have configured loopback interfaces (as per router names) along with physical interface in subnet of 10.0.0.0/24.

We have turned on all the routers at the same time to have fair election process, configured interfaces, loopback and basic ospf configuration with default backbone area 0.

R2: 2.2.2.2, R3:3.3.3.3, R4:4.4.4.4, R5:5.5.5.5 are the loopbacks interfaces.

Let’s check the packet and debug output to understand who gets elected first.

Initially when router’s come up, each one of them will consider itself as DR/BDR, but eventually after exchanging multicast Hellos on 224.0.0.5, they follow the below process and come to know about the actual DR/BDR for that segment.

debug ip ospf adj (use in real scenarios only when have you go ahead from customer or higher authorities as debugging takes up CPU of the device).

In this case, we have loopback, as per the above process, R5 5.5.5.5, should become the DR and 4.4.4.4 BDR. Let’s see if that’s the case

From R5 perspective:

1st Exchange of Hello’s

*Nov 30 09:30:38.419: OSPF-1 HELLO Et0/0: Send hello to 224.0.0.5 area 0 from 5.5.5.5
*Nov 30 09:30:48.387: OSPF-1 HELLO Et0/0: Send hello to 224.0.0.5 area 0 from 5.5.5.5
*Nov 30 09:30:50.302: OSPF-1 ADJ   Et0/0: end of Wait on interface
*Nov 30 09:30:50.302: OSPF-1 ADJ   Et0/0: DR/BDR election
*Nov 30 09:30:50.302: OSPF-1 ADJ   Et0/0: Elect BDR 5.5.5.5
*Nov 30 09:30:50.302: OSPF-1 ADJ   Et0/0: Elect DR 5.5.5.5
*Nov 30 09:30:50.302: OSPF-1 ADJ   Et0/0: Elect BDR 0.0.0.0
*Nov 30 09:30:50.302: OSPF-1 ADJ   Et0/0: Elect DR 5.5.5.5
*Nov 30 09:30:50.302: OSPF-1 ADJ   Et0/0: DR: 5.5.5.5 (Id)
*Nov 30 09:30:50.302: OSPF-1 ADJ   Et0/0:    BDR: none 
*Nov 30 09:30:58.165: OSPF-1 HELLO Et0/0: Send hello to 224.0.0.5 area 0 from 5.5.5.5

After sending/receiving multiple hellos on multicast address 224.0.0.5,

Final Election:

*Nov 30 09:31:21.250: OSPF-1 HELLO Et0/0: Rcv hello from 3.3.3.3 area 0 10.0.0.3
*Nov 30 09:31:21.250: OSPF-1 ADJ   Et0/0: Neighbor change event
*Nov 30 09:31:21.250: OSPF-1 ADJ   Et0/0: DR/BDR election
*Nov 30 09:31:21.250: OSPF-1 ADJ   Et0/0: Elect BDR 4.4.4.4
*Nov 30 09:31:21.250: OSPF-1 ADJ   Et0/0: Elect DR 5.5.5.5
*Nov 30 09:31:21.250: OSPF-1 ADJ   Et0/0: DR: 5.5.5.5 (Id)
*Nov 30 09:31:21.250: OSPF-1 ADJ   Et0/0:    BDR: 4.4.4.4 (Id)

As per above topology R5 has higher IP address for loopback so it becomes DR and R4 has second highest IP of loopback so its becomes BDR.

BDR is always elected first and then that BDR becomes DR and there is another election for second BDR (interview question)

Reason why BDR is elected first and the significance of BDR:

  1. Let’s consider there is no BDR in the following network, only 5.5.5.5 is the DR.
  2. When the DR goes down, there would be re-election process, which will cause the traffic to be drop till the new DR is elected.
  3. The New DR again needs to form adjacencies will all the routers in that network.
  4. If BDR is already present, it will avoid the traffic drop since it can take up the role of DR as soon as the DR goes down.
  5. Plus, there is no need to form new adjacencies, since BDR already has the same adjacencies as DR which went down.
  6. Even while election, if the DR goes down, BDR will immediately take the role of DR and one more BDR election will take place.

Who becomes DR/BDR in the segment(network):

As per RFC and standard Books:

  • DR/BDR is the router who has highest OSPF priority.
  • By default, all the routers are configured as default priority 1 which is carried inside hello packets.
  • If the priorities are same, election goes on the RID (router-id).
  • RID is the highest IP of loopback interface, in absence of loopback, RID is the highest IP of physical active interface.
  • We can also make routers as forceful DR by setting ospf priority to “255”, and DR others by ospf priority of “0”

For more detail understanding on how the actual process takes place Refer below:

Actual Step by Step Process which takes place while electing DR/BDR

The BDR is elected first as already discussed above, the process is as follows:

1. Whenever an OSPF neighbor comes or becomes active on mutli-access segment (eg: Ethernet), it considers itself as DR/BDR initially.

It then 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 neighbor discovery process starts.

3. DR/BDR are sent via Hello packets, if a receieved hello includes values for Dr/Bdr then it is accepted, wait timer stops.

4. Once the wait timer is expired, the DR election begins.

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

Related blog posts