Configuring OSPF DR and BDR with Interface Priority and Router ID
In all shared networks like Ethernet, Frame Relay, and ATM, OSPF selects one router as the DR and another as the BDR. The DR reduces the number of adjacencies in these networks, preventing the flow of duplicate LSAs. You can check our other tutorial about DR and BDR election to get a detailed understanding of this election process.
In an ideal scenario where all routers connect to a shared network at the same time, OSPF considers the interface priorities for the election. The router with the highest interface priority gets elected as the DR. In the following OSPF configuration example, we will verify this behavior using four routers connected to an Ethernet switch.
Table of Contents
OSPF Configuration Example 3.1: DR BDR election with Interface Priority
Objective: Verify that the DR election takes router priority into account. Ensure that the router with the highest priority is elected as the DR.
Topology:
Configuration Procedure :
- Configure the IP addresses on the routers as given below:
- R1: 10.1.1.1/8
- R2: 10.2.2.2/8
- R3: 10.3.3.3/8
- R4: 10.4.4.4/8
- Configure OSPF interface priority on R1 as 100.
- Configure OSPF interface priority on R2 as 50.
- Configure OSPF on all routers by enabling it on the interface where the network 10.0.0.0/8 is configured.
- Make sure that OSPF is enabled at the same time on all routers.
Understanding OSPF Interface Priority
The interface priority, a number in the range of 0 – 255, determines the DR and BDR election. If all routers participate at the same time, the router with the highest priority becomes the DR. Set the priority to 0 if you want a router to not participate in the election.
Setting the priority alone won’t decide the election results. OSPF uses a timer known as the wait timer during the election process. Only routers introduced within the wait time interval are considered for the election.
Read more about DR BDR election process here
Configuration Commands:
Configuring IP and Interface Priority on All Routers: As per the topology, Router 1 is configured with an OSPF priority of 100 and Router 2 with 50. Routers 3 and 4 will retain the default priority of 1.
#R1 Configuration
R1(config)# interface fastEthernet 0/0
R1(config-if)# ip address 10.1.1.1 255.0.0.0
R1(config-if)# ip ospf priority 100
R1(config-if)# no shutdown
#R2 Configuration:
R2(config)# interface fastEthernet 0/0
R2(config-if)# ip address 10.2.2.2 255.0.0.0
R2(config-if)# ip ospf priority 50
R2(config-if)# no shutdown
#R3 Configuration
R3(config)# interface fastEthernet 0/0
R3(config-if)# ip address 10.3.3.3 255.0.0.0
R3(config-if)# no shutdown
#R4 Configuration
R4(config)#interface fastEthernet 0/0
R4(config-if)#ip address 10.4.4.4 255.0.0.0
R4(config-if)# no shutdown
OSPF Configuration commands:
R1 Configuration
R1(config)# router ospf 1
R1(config-router)# network 10.0.0.0 0.255.255.255 area 0
Repeat the above two commands on R2, R3, and R4. Try to apply the “network
“ command simultaneously on all routers. This ensures that OSPF starts at the same time on all routers, allowing the election process to be based on the configured priorities.
Verification of OSPF DR and BDR Election :
To verify the results, run the ‘show ip ospf neighbor‘ command. This command displays the neighbor IDs and the corresponding adjacency state. In this example, R1 gets elected as the DR because it has the highest priority (100), and R2 gets elected as the BDR because it has the second highest priority (50). To check this, you can run this command on R3 or R4, which will list R1 and R2 as its neighbors.
Additionally, when you run this command on the DR (R1) or BDR (R2), you will see that they have formed FULL state adjacency with every router. When you run it on a DR Other (R3 or R4), you will see that they have formed FULL state adjacency only with the DR and BDR, stopping the adjacency formation once they reach the two-way state.
Output of “show ip ospf neighbor” on R4 (DR Other)
Output of “show ip ospf neighbor” on R1 ( DR )
Output of “show ip ospf neighbor” on R4 (DR Other)
OSPF Configuration Example 3.2: DR BDR Election with Router ID
Objective: Verify that OSPF elects the DR and BDR based on the Router IDs when the priorities are the same.
Configuration Procedure:
- Use the same topology and interface IP configuration as in the first example.
- Do not use the
ip ospf priority
command, which was previously used to change the priority. - Configure OSPF on all routers in the same way as in the first example.
- Try to apply the
network
command simultaneously on all routers.
OSPF considers the Router IDs of the devices for DR and BDR election if the priorities are the same on all routers. The device with the highest Router ID gets elected as the DR, and the one with the second highest becomes the BDR.
In this topology, if all the routers are enabled with OSPF together, R4 gets elected as the DR since it has the highest Router ID (10.4.4.4), and R3 becomes the BDR because it has the second highest (10.3.3.3).
To verify this, check the output of the ‘show ip ospf neighbor’ command on Router 1 or Router2.
Next >>> OSPF Configuration Example 4 : Redistribution Commands
Previous >>> OSPF Configuration Example 2: Multi-Area Setup
We’d love to hear your feedback and suggestions about this article. Feel free to reach out to us using the WhatsApp number below.
About The Author:
Sajith Achipra has been a trainer and testing consultant at Zframez Technologies since 2009. With 15+ years of experience, he specializes in networking, Python, development, and testing. He conducts online courses to help students and professionals enhance their skills. You can reach him on WhatsApp at +91 8884 884 844 for your training and testing requirements.