All routing protocols share similar components. They all use routing protocol messages to exchange route information. The messages help build data structures, which are then processed using a routing algorithm.
The three main components of the OSPF routing protocol include:
Data Structures
OSPF creates and maintains three databases: (see Figure 1).
- Adjacency database - Creates the neighbor table
- Link-state database (LSDB) - Creates the topology table
- Forwarding database - Creates the routing table
These tables contain a list of neighboring routers to exchange routing information with and are kept and maintained in RAM.
Routing Protocol Messages
OSPF exchanges messages to convey routing information using five types of packets. These packets, as shown in Figure 2, are:
- Hello packet
- Database description packet
- Link-state request packet
- Link-state update packet
- Link-state acknowledgment packet
These packets are used to discover neighboring routers and also to exchange routing information to maintain accurate information about the network.
Algorithm
The CPU processes the neighbor and topology tables using Dijkstra’s SPF algorithm. The SPF algorithm is based on the cumulative cost to reach a destination.
The SPF algorithm creates an SPF tree by placing each router at the root of the tree and calculating the shortest path to each node. The SPF tree is then used to calculate the best routes. OSPF places the best routes into the forwarding database, which is used to make the routing table.