OSPF Topology Database Exchange
 


OSPF routers exchange the contents of their LSDBs so that both neighbors have an exact copy of the same LSDB at the end of the database exchange process – a fundamental principle of how link-state routing protocols work.

Overview of the OSPF Database Exchange Process

After two OSPF routers become neighbors and reach a two-way state, the next step may not be to exchange topology information.  The routers must fist decide if they should directly exchange topology information, or if the two neighbors should learn each other’s topology information, in the form of LSAs, indirectly.  As soon as a pair of OSPF neighbors knows that they should share topology information directly, they exchange the topology data (LSAs).  After this is completed, the process moves to a relatively quiet maintenance state in which the routers occasionally reflood the LSAs and watch for changes to the network.

The overall process flows as follows:

Step 1: Based on the OSPF interface type, the routers may or may not collectively elect a Designated Router (DR) and Backup Designated Router (BDR).

Step 2: For each pair of routers that need to become fully adjacent, mutually exchange the contents of their respective LSDBs.

Step 3: When completed, the neighbors monitor for changes and periodically reflood LSAs while in the Full (fully adjacent) neighbor state.

Choosing a Designated Router

OSPF dictates that a subnet either should or should not use a Designated Router (DR) and Backup DR based on the OSPF interface/network type.  For the CCNA exams you should be aware of two main types of OSPF interfaces: point-to-point and broadcast.  These types can be configured with the ip ospf network type command.  These OSPF interface types make a general reference to the type of data-link protocol used.  Point-to-point is intended for use on point-to-point links, and the broadcast type is for use on data links that support broadcast frames, such as LANs.

When a DR is not required, neighboring routers can go ahead and start the topology exchange process.  With a DR, the topology exchange process happens between the DR and every other router, but not between every pair of routers.  All routing updates flow to and from the DR, with the DR distributing the topology information to the other routers.  All routers learn all topology information from all other routers, but the process only causes a direct exchange of routing information between the DR and each of the non-DR routers.

The DR concept prevents overloading a subnet with too much OSPF traffic when many routers are on a subnet.  Of course, lots of routers could be attached to a LAN.  If ten routers were attached to the same LAN subnet, and they were allowed to forward OSPF updates to each of the other nine routers, topology updates would flow between 45 different pairs of neighbors, with almost all the information being redundant.  With the DR concepts, that same LAN would require routing updates only between the DR and the nine other routers.

Because the DR is so important to the exchange of routing information, the loss of the elected DR could cause delays in convergence.  OSPF includes the concept of a Backup DR (BDR) on each subnet, so when the DR fails or loses connectivity to the subnet, the BDR can take over as the DR.  All routers except the DR and BDR are typically called “DROther” in IOS show command output.

When a DR is required, the neighboring routers hold an elect.  To elect a DR, the neighboring routers look at two fields inside the Hello packets they receive and choose the DR based on the following criteria:

* The router sending the Hello with the highest OSPF priority setting becomes the DR.

* If two or more routers tie with the highest priority setting, the router sending the Hello with the highest RID wins.

* It’s not always the case, but typically the router with the second-highest priority becomes the BDR.

* A priority setting of 0 means that the router does not participate in the election and can never become the DR or BDR.

* The range of priority values that allow a router to be a candidate are 1 through 255.

* If a new, better candidate comes along after the DR and BDR have been elected, the new candidate does not preempt the existing DR and BDR.

Database Exchange

After two routers decide to exchange databases, they do not simply send the contents of the entire database.  First, they tell each other a list of LSAs in their respective databases, not all the details, just a list.  Each router then compares the other router’s list to its own LSDB.  For any LSAs that a router does not have a copy of, the router asks the neighbor for a copy of the LSA, and the neighbor sends the full LSA.

When two neighbors complete this process, they have fully completed the database exchange process.  So OSPF uses the Full neighbor state to mean that the database exchange process has been completed.