OSPF Designated Router Election
By stretch | Thursday, June 2, 2011 at 10:12 p.m. UTC
Today we'll look at a few ways to influence the designated router (DR) and backup DR (BDR) elections on a multi-access segment of five OSPF routers. Due to my IPv6 resolution, we'll be using OSPFv3 in this article, but the election process works pretty much the same for both OSPFv2 and OSPFv3.
Default Configurations
By default, all IOS OSPF routers are assigned a DR priority of 1. Ties among routers with equal DR priorities are broken by router ID, with the highest RID being preferred.
In our topology, R5 (0.0.0.5) will be elected as the DR and R4 (0.0.0.4) the BDR (assuming that all routers come online at roughly the same time).
R1# show ipv6 ospf interface f0/0 FastEthernet0/0 is up, line protocol is up Link Local Address FE80::1, Interface ID 4 Area 0, Process ID 1, Instance ID 0, Router ID 0.0.0.1 Network Type BROADCAST, Cost: 10 Transmit Delay is 1 sec, State DROTHER, Priority 1 Designated Router (ID) 0.0.0.5, local address FE80::5 Backup Designated router (ID) 0.0.0.4, local address FE80::4 Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 Hello due in 00:00:03 Index 1/2/2, flood queue length 0 Next 0x0(0)/0x0(0)/0x0(0) Last flood scan length is 0, maximum is 3 Last flood scan time is 0 msec, maximum is 0 msec Neighbor Count is 4, Adjacent neighbor count is 2 Adjacent with neighbor 0.0.0.5 (Designated Router) Adjacent with neighbor 0.0.0.4 (Backup Designated Router) Suppress hello for 0 neighbor(s) R1# show ipv6 ospf neighbor Neighbor ID Pri State Dead Time Interface ID Interface 0.0.0.2 1 2WAY/DROTHER 00:00:34 4 FastEthernet0/0 0.0.0.5 1 FULL/DR 00:00:38 4 FastEthernet0/0 0.0.0.4 1 FULL/BDR 00:00:37 4 FastEthernet0/0 0.0.0.3 1 2WAY/DROTHER 00:00:36 4 FastEthernet0/0
Manual Priority Configurations
We can influence the DR election process by administratively configuring higher priorities for routers we want to win the DR election. Suppose we wanted R1 to become the DR and R2 to become the BDR:
R1(config)# interface f0/0 R1(config-if)# ipv6 ospf priority 100
R2(config)# interface f0/0 R2(config-if)# ipv6 ospf priority 90
DRs cannot be preempted by routers with a higher priority once they have been elected, so we'll need to disconnect all routers from the network in order to force a new election. When the interfaces come back online, we see that R1 and R2 have been elected as the DR and BDR, respectively.
R1# show ipv6 ospf neighbor Neighbor ID Pri State Dead Time Interface ID Interface 0.0.0.4 1 FULL/DROTHER 00:00:38 4 FastEthernet0/0 0.0.0.2 90 FULL/BDR 00:00:38 4 FastEthernet0/0 0.0.0.5 1 FULL/DROTHER 00:00:38 4 FastEthernet0/0 0.0.0.3 1 FULL/DROTHER 00:00:38 4 FastEthernet0/0
Notice that R1 does not report any OSPF neighbor as a DR; this is because R1 itself is the DR. This is akin to the saying, "If you can't spot the sucker at a card game, you are the sucker." This isn't always the case, though, as we'll see shortly. Always verify whether the local router is fulfilling the DR or BDR role with show ip[v6] ospf interface
:
R1# show ipv6 ospf interface f0/0 FastEthernet0/0 is up, line protocol is up Link Local Address FE80::1, Interface ID 4 Area 0, Process ID 1, Instance ID 0, Router ID 0.0.0.1 Network Type BROADCAST, Cost: 10 Transmit Delay is 1 sec, State DR, Priority 100 Designated Router (ID) 0.0.0.1, local address FE80::1 Backup Designated router (ID) 0.0.0.2, local address FE80::2 Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 Hello due in 00:00:05 Index 1/2/2, flood queue length 0 Next 0x0(0)/0x0(0)/0x0(0) Last flood scan length is 2, maximum is 6 Last flood scan time is 0 msec, maximum is 0 msec Neighbor Count is 4, Adjacent neighbor count is 4 Adjacent with neighbor 0.0.0.4 Adjacent with neighbor 0.0.0.2 (Backup Designated Router) Adjacent with neighbor 0.0.0.5 Adjacent with neighbor 0.0.0.3 Suppress hello for 0 neighbor(s)
No BDR Router
The backup DR is just that: a backup. In some situations, such as a hub-and-spoke topology with a single hub, it doesn't make sense to have a BDR at all. We can prevent routers from ever becoming a DR or BDR by configuring a priority of zero. So long as one router on the network has a non-zero priority, it will become the DR.
R2(config)# interface f0/0 R2(config-if)# ipv6 ospf priority 0
R3(config)# interface f0/0 R3(config-if)# ipv6 ospf priority 0
R4(config)# interface f0/0 R4(config-if)# ipv6 ospf priority 0
R5(config)# interface f0/0 R5(config-if)# ipv6 ospf priority 0
R1# show ipv6 ospf neighbor Neighbor ID Pri State Dead Time Interface ID Interface 0.0.0.2 0 FULL/DROTHER 00:00:38 4 FastEthernet0/0 0.0.0.4 0 FULL/DROTHER 00:00:38 4 FastEthernet0/0 0.0.0.3 0 FULL/DROTHER 00:00:38 4 FastEthernet0/0 0.0.0.5 0 FULL/DROTHER 00:00:38 4 FastEthernet0/0
Note that in this case we are not required to disconnect and reconnect the interfaces to force a new election. Although a new DR or BDR cannot be chosen without a new election, a DR or BDR can resign from its current role without an election.
No DR or BDR
What happens if we set the priority of R1 (the DR) to zero as well?
R1(config)# interface f0/0 R1(config-if)# ipv6 ospf priority 0 R1(config-if)# ^Z R1# show ipv6 ospf neighbor Neighbor ID Pri State Dead Time Interface ID Interface 0.0.0.2 0 2WAY/DROTHER 00:00:33 4 FastEthernet0/0 0.0.0.4 0 2WAY/DROTHER 00:00:36 4 FastEthernet0/0 0.0.0.3 0 2WAY/DROTHER 00:00:36 4 FastEthernet0/0 0.0.0.5 0 2WAY/DROTHER 00:00:35 4 FastEthernet0/0
There are no longer any established OSPF adjacencies among any of the routers. Interestingly, this does not immediately affect the routing topology:
R1# show ipv6 route ospf IPv6 Routing Table - 8 entries Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP U - Per-user Static route, M - MIPv6 I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary O - OSPF intra, OI - OSPF inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2 ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2 D - EIGRP, EX - EIGRP external O 2001:DB8:0:1::2/128 [110/10] via FE80::2, FastEthernet0/0 O 2001:DB8:0:1::3/128 [110/10] via FE80::3, FastEthernet0/0 O 2001:DB8:0:1::4/128 [110/10] via FE80::4, FastEthernet0/0 O 2001:DB8:0:1::5/128 [110/10] via FE80::5, FastEthernet0/0
However, the LSAs for these routes will eventually expire, and no changes in the routing topology can be advertised. If we were to disconnect and reconnect all router interfaces again, all neighbors would remain in the 2WAY/DROTHER state. None would be elected as the DR on the network and no routes could be advertised among the routers.
Posted in Routing
Comments
June 3, 2011 at 4:01 a.m. UTC
But you could assign neighbors within your ospf statements with all set to zero and still establish adjacencies, correct?
June 3, 2011 at 10:05 a.m. UTC
Hey Stretch,
great article and timely too as I'm studying ospf. I like the use of IPv6 also as it's starting to sink in through osmosis :-)
So the router id or RID is basically the highest IP address on the Router correct?
Thanks,
Paul
June 3, 2011 at 2:25 p.m. UTC
To answer Joey's question, DR/BDR elections are only on NBMA and Broadcast network types. Of those 2, only NBMA (ip ospf network non-broadcast) is allowed to use the neighbor statement. If you debug the ospf adjacency this is what you will see if the priorities on all are set to 0 even with the neighbor statement:
*Jun 3 10:09:04.675: OSPF: Neighbor change Event on interface FastEthernet0/0 *Jun 3 10:09:04.675: OSPF: DR/BDR election on FastEthernet0/0 *Jun 3 10:09:04.675: OSPF: Elect BDR 0.0.0.0 *Jun 3 10:09:04.675: OSPF: Elect DR 0.0.0.0 *Jun 3 10:09:04.675: DR: none BDR: none
Neighbors will still be stuck in ATTEMPT/DROTHER state.
June 3, 2011 at 2:57 p.m. UTC
Correct Paulkil, the selection of RID by default will be the highest in difference but if there is a loopback configures it will prefer it.
Great article Stretch!
June 5, 2011 at 8:18 a.m. UTC
Really all what i can say about this post is "FANTASTIC"
June 19, 2011 at 9:43 a.m. UTC
Yes great !! but you are using the fastethernet interface there elected DR/ BDR election process DR/BDR elected as 224.0.0.6 in your lab format . But i created as a serial interfaces without using the NBMA there is no election process. They shows as Full/-
Why it can't forms.Normally NBMA is not elected DR/BDR they are point to point or point-to-multipoint.
can you clarify my doubt.I posted a topic in the same question. plz.. answer that if you know. Thank you...
June 25, 2011 at 1:24 p.m. UTC
Great article. I never thought about what would happen if you withdrew the DR from the OSPF topology with all the routers set to not participate in the election process.
@yesudas
It helps to think of it this way:
All multiaccess networks need the DR/BDR election process in order to have a central point to transmit LSAs. One of the reasons, if not THE reason for this is to prevent LSA flooding. You can approximate NBMA networks with point-to-point serial interfaces by using a frame relay switch in the middle and having the broadcast command configured in your frame-relay map. Perhaps you have confused NBMA with point-to-point serial interfaces due to the interface type used? If you connect routers to other routers using a serial link then they're point-to-point networks, not NBMA networks.
October 11, 2011 at 12:12 p.m. UTC
Hello,
I have created an ISATAP tunnel connecting 2 IPv6 islands(over an IPv4 network) in the lab. Since, in NBMA networks if the priority of all OSPF neighbors are set to 0, adjacency will not be formed and would be stuck in 'ATTEMPT/DROTHER' state. Would changing the OSPF priority at one of the interface end points of the tunnel result in the adjacency being formed?
I am not able form OSPFv3 adjacency between the 2 end points of the tunnel. Any suggestions?
Cheers,
Kaustubh
October 12, 2011 at 8:43 a.m. UTC
All, I got it working. It was due to a rogue static route pointing to one of the tunnel interfaces. Thanks.
March 4, 2012 at 8:34 a.m. UTC
Hi, about modifying the priority Id in specifying the DR and BDR, does it always have to be on F0/0 or could it be on F0/1 also?
June 18, 2012 at 8:57 a.m. UTC
Neighbor ID Pri State Dead Time Address Interface
2.2.2.2 1 FULL/DR 00:00:38 20.20.20.1 FastEthernet1/0
1.1.1.1 1 FULL/DR 00:00:37 10.10.10.1 FastEthernet0/0
i have 2 DR in area 0, what happened????
June 30, 2013 at 12:49 p.m. UTC
Vahid,
I made the same mistake as a newbie. I believe what had happened here is that you have two separate segments i.e.broadcast domains. Since this is the case your router is DR for both of these broadcast domains.
- Nik
September 12, 2013 at 8:13 a.m. UTC
Hello Jeremy,
Can you please explain how a DR Going down event is handeled in OSPF.
IF the DR goes down how does the topology know to promote the BDR as the DR ?
What are the timer involved in the background,if any ?
November 6, 2013 at 5:50 p.m. UTC
I have a question concerning the usefulness of DR.
In the multi-access network topology that you explain above, what are the benefits of using DR compared to each router uses a broadcast MAC address to forward its LSP, and eventually an IP multicast address to communicate only with OSPF router in case that any one of the multi access router is not running OSPF.
I can not really see how does DR reduce the amount of exchanged LSP packets.
November 30, 2013 at 6:42 p.m. UTC
Hi,
In the first output where priority is 1 for all routers and after DR BDR election all other router are in 2way/DROTHER but later in all other scenerios they are showing as FULL/DROTHER
How is that hapening? Can you please explain?
Thanks
December 16, 2013 at 6:08 p.m. UTC
Hi Jeremy,
Thank you, it was very useful post for me.
March 18, 2014 at 10:43 p.m. UTC
This concise and clear look at OSPF neighbors helped me keep this sorted out for a recent certification exam, thanks!
November 21, 2014 at 7:43 a.m. UTC
Wonderful article at the same time it is written amazingly simple words that made it very easy to understand at 1st sight.
December 31, 2014 at 11:48 a.m. UTC
This article has removed all the confusion I had regarding the OSPF DR/BDR election and the sequence a router will follow to define it's ID.
Thank you.
March 1, 2015 at 1:08 a.m. UTC
hey i think i worked out a way to make a new router the DR.
if the topology already has a DR and BDR and you have a new router to add to the network that you want to become DR
1.give this routers interface the highest ospf priority and insert it into the topology. 2. shutdown the DR which should make the current BDR take status of DR. 3. now an election will take place for BDR which the new router you have introduced will win. 4.now restart the old DR which you shut down 5.now shutdown the current DR...which will force the BRAND new router to become DR.... as that happens there will be an election for BDR which the old DR will win.
job done the system was fully functional . and minimum disruption and now your new router is the DR and the old DR is now BDR
April 8, 2015 at 5:58 p.m. UTC
Hi Jeremy, what will happen if we configure the highest priority router at the end ? when any other router is already elected as DR, assuming all the routers are participating in the election...
Thankyou...
January 25, 2016 at 5:46 a.m. UTC
@ali Ahmed: its already mentioned above that once any router become DR it will not preempt it self if you have set any priority after the selection you need to reset your peers once the election happen next time then your highest priority router will become DR
March 20, 2016 at 8:07 a.m. UTC
Is there any way to make the Router is DR even though the priority for this router and the router ID isn't the highest?
June 25, 2016 at 12:43 a.m. UTC
Hi,
I know BDR takes over once DR goes down, but can someone please give detail step about it ?