Introduction and Exclusive Explanation of OSPF Operation
If router interface is configured with OSPF, the router must determine if there is another OSPF neighbour on the link. To do this, the router forwards a Hello packet that containing its router ID out all OSPF-enabled interfaces as multicast. The router ID is used by the Open Shortest Path First process to individually recognize every router in the OSPF area.
A router ID is an IP address assigned to identify a specific router among OSPF links. When neighbouring router which is configured with Open Shortest Path First, receives a Hello packet containing router ID that is not listed with the receiving router it attempts to establish an adjacency with the initiating router.
For example, as shown in the figure-1 above, When OSPF is enabled on Rouer1, the enabled Fast Ethernet 0/1 interface transitions from the Downstate to the Init state and starts sending Hello packets out all OSPF-enabled interfaces to discover OSPF neighbours to develop adjacencies with.
The Router2 receives the Hello packet from Router1 and adds the Router1 ID to its neighbour list. Then Router2 sends a Hello packet to Router1. The packet contains the Router2 Router ID including Router1 ID in its neighbours’ list on the same interface.
When Router1 receives the Hello packet and adds the Router2 Router ID in its OSPF neighbours list. Router1 also notices its Router ID in the Hello packet’s list of neighbours. When a Router1 receives a Hello packet with its Router ID listed in the neighbour’s list, the Router1 transitions from the Init state to the Two-Way state.
The action in Two-Way state depends on the type of interconnection between the adjacent routers. If the two adjacent neighbours are connected over a point-to-point link, then they instantly transition from the Two-Way state to the database synchronization stage. If the routers are interconnected over a general Ethernet network, then a DR and BDR must be elected.
Note:-Hello packets are repeatedly exchanged to maintain router information.
DR and BDR Election
Because Router1 and Router2 are connected over an Ethernet network, so a DR and BDR election takes place. 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 second-highest router ID (192.168.10.1). This process only takes place on multi-access networks such as Ethernet LANs.
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 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.
The formula for understanding the problem with multiple adjacencies is following:
n(n – 1) / 2
n is the number of the router in the OSPF topology. For example, if there are 4 routers in the topology as shown in the figure-3 and all routers 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 look like too much, but as routers added to the network, the number of adjacencies increases dramatically, as shown in the below calculation.
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 changing occurs in the network or during initializing. Each router sends LSA and also required acknowledgements sent 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 confused. Suppose if there are 50 routers on the network without DR and BDR, each router will send 1225 LSAs and receives 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. On multi-access networks, OSPF elects a DR 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 database synchronization stage. As the Hello packet 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 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 that appears in the router’s LSDB.
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 also 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 do the following actions:
- It sends 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 reply 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 fulfilled for a particular router, the adjacent routers considered as synchronized and in a full state.
if the neighbouring routers continue receiving Hello packets, the network in the transmitted LSAs stays in the topology database. After the topological databases get synchronized, Link-state updates have sent only to neighbours when:
- A change is apparent
- Every 30 minutes