Azeem,
The BDR is elected first (see step #7 below). Here is a break down of what happens during the election:
- 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.
- The router starts neighbor discovery. It sends the 0.0.0.0 values for DR/BDR
- If a received Hello includes values for DR/BDR, these are accepted and the wait timer is stopped
- If the wait timer expires, the DR election starts
- A list of neighbors on the multiaccess network is established that are eligible for being DR/BDR (their priority is higher than zero)
- 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)
- From this subset, select the router with the highest priority/RID/Loopback/Address to be the BDR
- From the original (not subset list), select the Router with the highest priority/RID/loopback/address to be the DR
- 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