What is OSPF PROTOCOL? Explained with Dijkstra’s Algorithm and Example.

The full form of OSPF is the Open shortest path first. It is a protocol for the routing process. This protocol is used to find the shortest path between multiple routers. In this scenario, multiple routers are connected through each other with the help of links these routers are called nodes. Each node is connected with other nodes like a hierarchy. There is no limit to nodes connections.

The work of each node is to send topology information to the adjacent nodes. This process is continuous, which means if one sends the information to the adjacent then the receiver will propagate information further. Each node is independent and they can find an appropriate and convenient path for the process themselves.

Few OSPF terms are given below:

Router_Id:-priority is every person has a different identity to identify uniquely, the same condition is applied to a router. we can assign a router-id manually and it can be automatically configured by protocol.

Router Priority:-8 bit value that configures to a router to assign priority. A router that has a higher priority will start first and this condition is called DR. If the router priority is the same then the router with a higher id will consider it first. There is also a condition when router-id is not defined, then the priority will be considered on the basis of the active IP address.

Down:- down is a condition in which the router doesn’t send any packages or messages that don’t mean the router is not working which means OSPF is not started working yet.

Master-Slave Relation:- A router that has a higher priority is to act as a master node and the rest are called slave nodes. to identify the priority, some elections are taking place who tells which node will send the message first.

DBD(database description packet)

LSU(Link state update)

There are many algorithms in the OSPF protocol:

Shortest Path Routing: The protocol is also called Dijkstra’s algorithm. This is a very basic and important algorithm in OSPF. In this algorithm we have to find the shortest path between the nodes, firstly we have to decide the initial and final point.

How does the OSPF protocol work?

For example, let’s suppose we have 9 nodes and they are connected with each other like a web of spiders. This means there are many ways between 2 nodes via other nodes eg.

OSPF protocol example
OSPF protocol example

As shown in the figure when we are going from 0 to 2 then there are two ways first is directly 0 to 2 and the second is via 1 so whenever we are using this algorithm we should take care of each and every possibility of reaching the source to destination. We can’t apply any kind of assumptions to Dijkstra’s algorithm. We can also find the shortest path with the help of programming. So if you are not familiar with programming then we can find this value manually also. now I am going to solve one shortest path routing algorithm.

Let’s begin the algorithm by first looking at point 0. We will move towards point 8, for that we have to pass another 7 number sequentially. So, 0 to 1 distance is 3 which is quite simple. Because we have no other shortest way to reach 1.

Now 0 to 2 as you can see there are two ways to reach point 2.  The first is 0 to 2 and another is 0 to 2 via 1 but both distances are the same so we can use anyone from the two paths.

Now (0 to 3 ). In 0 to 3 we will go via 0,1,3 which is 3+5=9 .

for 0 to 4 we will go from 0,1,4 .as we can see 3+4=7 and if we go from 0,2,4 then the distance is 6+5=11 so 7 is least.

From 0 to 5 we follow the distance 0,1,3,5 the distance would be 3+5+4=12

For 0 to 6 the shortest path will be 0,1,4,6 and the sum is 3+4+2=9 which is the shortest from other paths.

0 to 7 is 0,1,4,6,8,7 and the value is 3+4+2+4+2=15

0 to 8 distance will 0,1,4,6,8 and value is 3+4+2+4=13

Configuration: configuration is like an IP address assigned to the router. We can assign IP addresses manually to the router and pcs .in cisco we can connect n number of routers, hubs pc with different IP addresses. If we did not set the IP addresses properly it will give an error because there is fix range of to

There are some steps on how we can configure OSPF in a single area.

First, we have to switch on the router.

Second, we have to give commands to the router to enable the interface.

Third, enable the interfaces and identify the area in which we have to assign.

And last is assign the IP.