OSPF DR and BDR election diagram showing Router1 as BDR and Router2 as DR based on default priorities and router IDs in a multi-access network.

Understanding OSPF Neighbor Adjacencies, DR/BDR Election, and Database Synchronization

If a router interface is configured with OSPF, the router must determine if another OSPF neighbor is on the link. To do this, the router forwards a Hello packet containing its router ID to all OSPF-enabled interfaces as multicast. The OSPF process uses the router ID to recognize every router individually in the OSPF area.

A router ID is an IP address assigned to identify a specific router among OSPF links. When a neighboring router, configured with OSPF, receives a Hello packet containing a router ID that is not listed in its OSPF neighbor table, it attempts to establish an adjacency with the initiating router.

For example, as shown in Figure 1 below, when OSPF is enabled on Router1, the enabled FastEthernet 0/1 interface transitions from the Down state to the Init state and starts sending Hello packets to all OSPF-enabled interfaces to discover OSPF neighbors with whom to develop adjacencies. (Note: In modern Cisco devices, interfaces are often GigabitEthernet, but FastEthernet is used here for legacy CCNA examples.)

OSPF neighbor states diagram illustrating progression from Down to ExStart between two Cisco routers on a 192.168.10.0/24 subnet, showing multicast Hello packets, unicast responses, neighbor lists, and master-slave negotiation in ExStart state.
Understanding OSPF Neighbor Adjacencies, DR/BDR Election, and Database Synchronization 7

Router2 receives the Hello packet from Router1 and adds the Router1 ID to its OSPF neighbor list. Then, Router2 sends a Hello packet to Router1. The packet contains the Router2 router ID, including the Router1 ID in its neighbors’ list on the same interface.

When Router1 receives the Hello packet and adds the Router2 router ID to its OSPF neighbors list, Router1 also notices its router ID in the Hello packet’s list of neighbors. When Router1 receives a Hello packet with its router ID listed in the neighbor’s list, it transitions from the Init state to the Two-Way state.

The action in the Two-Way state depends on the type of interconnection between the adjacent routers. If the two adjacent neighbors are connected over a point-to-point link, they instantly transition from the Two-Way state to the database synchronization stage. A DR and BDR must be elected if the routers are interconnected over a common Ethernet network.

Note: Hello packets are repeatedly exchanged to maintain router information.

DR/BDR Election

A DR/BDR election occurs because Router1 and Router2 are connected over an Ethernet network. The figure below illustrates the election between Router1 and Router2.

Router2 becomes the DR because of the highest router ID (192.168.10.2), and Router1 becomes the BDR because of the second-highest router ID (192.168.10.1). This process only takes place on multi-access networks such as Ethernet LANs.

OSPF DR and BDR election diagram showing two routers on a 192.168.10.0/24 segment with default priority 1; Router1 (second-highest ID) as BDR and Router2 (highest ID) as DR in a multi-access OSPF network.
Understanding OSPF Neighbor Adjacencies, DR/BDR Election, and Database Synchronization 8

DR and BDR election is necessary because multi-access networks can create two challenges for OSPF about the flooding of LSAs:

  • Creation of multiple adjacencies – The routers on Ethernet networks interconnect to many
  • Open Shortest Path First routers over a common link. So, creating adjacencies with every router is not important and not wanted. The interconnection to many routers leads to an unnecessary number of LSAs exchanged between routers on the same network.
  • Extensive flooding of LSAs – Link-state routers flood their LSAs when OSPF is initialized, or when there is a modification in the topology. This flooding can become very excessive.

OSPF Neighbor Adjacencies formula

The formula for understanding the problem with multiple adjacencies is as follows:

n(n – 1) / 2

Diagram of four OSPF routers (Router1, Router2, Router3, Router4) in a full mesh multi-access network, illustrating six pairwise adjacencies with orange arrows connecting each router's Fa0/1 or Fa0/0 interfaces, highlighting the n(n-1)/2 formula challenge.
Understanding OSPF Neighbor Adjacencies, DR/BDR Election, and Database Synchronization 9

n is the number of the router in the OSPF topology. For example, if there are 4 routers in the topology, as shown in Figure 3, and all routers are attached to the same multi-access network, there are n (n– 1) / 2 adjacencies in the topology. Without a mechanism to reduce the number of adjacencies, collectively, these routers would form 6 adjacencies:

4 (4 – 1) / 2 = 6

This does not seem like too much, but as routers are added to the network, the number of adjacencies increases dramatically, as shown in the calculation below.

10 routers = 10(10-1) = 45 adjacencies

20 routers = 20(20-1) = 190 Adjacencies

50 routers = 50(50-1) = 1225 Adjacencies

100 routers = 100(100-1) = 4950 Adjacencies

To understand the problem of extensive flooding of LSAs, if DR and BDR are not available in the network when a change occurs in the network or during initialization. Each router sends LSAs and acknowledgments are also required for every LSA received.

If every router in a multi-access network had to flood and acknowledge all received LSAs to all other routers on that same multi-access network, the network traffic would become quite confusing. Suppose there are 50 routers on the network without DR and BDR. Each router will send 1225 LSAs and receive 1225 Acknowledgments, which is very extensive.

The solution to managing the number of adjacencies and the flooding of LSAs on a multi-access network is the DR and BDR. OSPF elects a DR on multi-access networks as the collection and distribution point for LSAs sent and received. A BDR is also elected for the same purpose in case the DR fails. All other routers turn into brothers. A DROTHER is a router that is not a DR or the BDR.

Database Synchronization Stage

After the Two-Way state, routers transit to the database synchronization stage. As the Hello packet is used to launch neighbour adjacencies, the other four types of Open Shortest Path First packets has used in the process of exchanging and synchronizing LSDBs.

In the database synchronization stage, the first state is ExStart state, in this state, a master and slave relationship is created between each router and its adjacent DR and BDR. The router with the higher router ID acts as the master for the exchange state. In Figure-4 below, Router2 becomes the master.

In the Exchange state, the master and slave routers exchange one or more DBD packets. A DBD packet also includes information about the LSA entry header in the router’s LSDB.

OSPF adjacency states flowchart from Down to ExStart between Router1 (RID 192.168.10.1) and Router2 (RID 192.168.10.2) on a 192.168.10.0/24 segment, depicting multicast Hello packets, unicast responses, neighbor lists, and master election in ExStart state.
Understanding OSPF Neighbor Adjacencies, DR/BDR Election, and Database Synchronization 10

The entries can be about a network or a link, and each LSA entry header also includes information about the type of link state, the advertising router address, the cost of the link, and the sequence number. The sequence number determines the newness of the received link state information.

In Figure-5, Router2 sends a DBD packet to Router1, and Router1 receives the DBD packet and does the following actions:

  • It acknowledges the receipt of the DBD packet using the LSAck packet.
  • Sends DBD packets to Router2.
  • Router2 acknowledges Router1.

Router1 compares the received information with the information it has in its LSDB. If the DBD packet has a more current link-state entry, the router transitions to the Loading state. For example, in Figure 6, Router1 sends an LSR about network 192.168.20.0 to Router2, and Router2 replies with the complete information about 192.168.20.0 in an LSU packet.

On reception of LSU, Router1 sends an LSAck. Router1 then adds the new link-state entries into its LSDB. When all LSRs are fulfilled for a particular router, the adjacent routers are considered synchronized and in a full state.

OSPF database synchronization diagram from ExStart to Loading states between Router1 (RID 192.168.10.1) and Router2 (RID 192.168.10.2) on 192.168.10.0/24, showing DBD exchanges, LSR for 192.168.20.0, LSU response, and LSAck acknowledgments.
Understanding OSPF Neighbor Adjacencies, DR/BDR Election, and Database Synchronization 11

If the neighboring routers continue receiving Hello packets, the network in the transmitted LSAs will stay in the topology database. After the topological databases get synchronized, Link-state updates are sent only to neighbors when:

  • A change is apparent
  • Every 30 minutes

FAQs

What is the role of Hello packets in OSPF?

Hello packets are multicast on OSPF-enabled interfaces to discover neighbors and establish adjacencies. They include the router’s ID for unique identification. When a router receives a Hello with its ID listed, it transitions to the Two-Way state, maintaining ongoing neighbor information.

Why are DR and BDR elected in OSPF on multi-access networks?

DR (Designated Router) and BDR (Backup Designated Router) are elected to minimize adjacencies and LSA flooding. On Ethernet LANs, the router with the highest ID becomes DR. This reduces excessive network traffic, as DROTHERs only form adjacencies with DR/BDR.

What happens during the OSPF database synchronization stage?

After the Two-Way state, routers enter ExStart to form master-slave relationships (higher ID as master). In exchange, DBD packets share LSDB headers. If needed, Loading state uses LSR/LSU for updates, leading to Full state with synchronized databases.

How does the adjacency formula illustrate OSPF challenges?

The formula n(n-1)/2 calculates adjacencies in multi-access networks. For 4 routers, it’s 6; for 100, it’s 4950. Without DR/BDR, this leads to excessive LSA flooding and acknowledgments, making networks inefficient.

Avatar of Asad Ijaz

Asad Ijaz

NetworkUstad's lead networking architect with CCIE certification. Specializes in CCNA exam preparation and enterprise network design. Authored 2,800+ technical guides on Cisco systems, BGP routing, and network security protocols since 2018. Picture this: I'm not just someone who writes about tech; I'm a certified expert in the field. I proudly hold the titles of Cisco Certified Network Professional (CCNP) and Cisco Certified Network Associate (CCNA). So, when I talk about networking, I'm not just whistling in the dark; I know my stuff! My website is like a treasure trove of knowledge. You'll find a plethora of articles and tutorials covering a wide range of topics related to networking and cybersecurity. It's not just a website; it's a learning hub for anyone who's eager to dive into the world of bits, bytes, and secure connections. And here's a fun fact: I'm not a lone wolf in this journey. I'm a proud member and Editor of Team NetworkUstad. Together, we're on a mission to empower people with the knowledge they need to navigate the digital landscape safely and effectively. So, if you're ready to embark on a tech-savvy adventure, stick around with me, Asad Ijaz Khattak. We're going to unravel the mysteries of technology, one article at a time!"