Maintaining LSDB and building the IP Routing Table
 


Maintaining the LSDB While Being Fully Adjacent

Neighbors in a Full state still do some maintenance work.  They keep sending Hellos every Hello interval.  The absence of Hellos for a time equal to the Dead Interval means that the connection to the neighbor has failed.  Also, if any topology changes occur, the neighbors send new copies of the changed LSAs to each neighbor so that the neighbor can change its LSDBs.

The router that creates each LSA will reflood the LSA every 30 minutes by default, even if no changes occur.  OSPF does not send all routers every 30 minutes.  Instead, each LSA has a separate timer, based on when the LSA was created.  So, there is no single moment when OSPF sends a lot of messages to reflood all LSAs.

Some routers do not attempt to become fully adjacent.  On interfaces on which a DR is elected, routers that are neither DR nor BDR become neighbors, but they do not become fully adjacent.  These non-fully adjacent routers do not directly exchange LSAs.  Also, the show ip ospf neighbor command on which a router lists these neighbors in a two-way state as the normal stable neighbor state, and Full as the normal state for the DR and BDR.

Summary of Neighbor States

OSPF Neighbor States and Their Meanings

Neighbor State Meaning
Down A known neighbor is no longer reachable, often because of an underlying interface failure.
Init An interim state in which a Hello has been heard from the neighbor, but that Hello does not list the router’s RID as having been seen yet.
Two-way The neighbor has sent a Hello that lists the local router’s RID in the list of seen routers, also implying that neighbor verification checks all passed.
Full Both routers know the exact same LSDB details and are fully adjacent.

Building the IP Routing Table

OSPF routers send messages to learn about neighbors, listing those neighbors in the OSPF neighbor table.  OSPF routers then send messages to exchange topology data with these same neighbors, storing the information in the OSPF topology table, more commonly called the LSDB or the OSPF database.  To fill the third major table used by OSPF, the IP routing table, OSPF does not send any messages.  Each router runs the Dijkstra SPF algorithm against the OSPF topology database, choosing the best routes based on that process.

The OSPF topology database consists of subnet numbers (called links, ie: link-state database).  It also contains lists of routers, along with the links (subnets) to which each router is connected.  A router can run the SPF algorithm to compute the best routes to all the subnets.  The detailed information in each LSA gives the SPF algorithm enough information to figure out which routers connect to each subnet and create the mathematical equivalent of a network diagram.

Each router independently uses the Dijkstra SPF algorithm, as applied to the OSPF LSDB, to find the best route from that router to each subnet.  The algorithm finds the shortest path from that router to each subnet in the LSDB.  Then the router places the best route to each subnet in the IP routing table.  You do not need to know SPF math for the exams.  You do need to be able to predict the routes SPF will choose using network diagrams and documentation.

OSPF chooses the least-cost route between the router and a subnet by adding up the outgoing interfaces’ OSPF costs.  Each interface has an OSPF cost associated with it.  The router looks at each possible route, adds up the costs on the interfaces out which packets would be forwarded on that route, and then picks the least-cost route.