How OSPF works?

OSPF (Open Shortest Path First) is an internal link-state dynamic routing protocol. Internal Routing protocol means that it works inside our network or inside our Autonomous system which is a network where we have full access to it such as a bank, a hospital, an organization, etc.….

Link-state because OSPF is part of link-state routing protocol and not part of the distance vector one. Another protocol that is part of link-state routing protocol is IS-IS (Intermediate System – Intermediate System).

Dynamic routing protocol means that when applied it works dynamically and discover routes to destinations by itself. So, when you enable OSPF on a network consisting of 10 routers for example, you will have to enable it on all routers which by themselves can teach each other about their connected networks which lead that all routers can know all destination networks in that Autonomous System. It is totally different than Static Routes which require an administrator to configure it on each router for each possible route.

Let us see now how OSPF works in our network.

How OSPF works?

Once OSPF is enabled on Huawei routers, all routers will start sending link-state advertisements (LSA) to all other routers as you can see in the picture above.

In the LSA packets, 2 main things are there:

  • Link: each router will say that he is sending the LSA from his own interface
  • State: the router describes what is the type of interface the LSA is sent from and how it is connected to the neighbor router(s).

By doing so, and after the LSA packets are being exchanged between all routers, each router will have a complete map of the whole network saved in his database. This database is called link-state database (LSDB).

Now that each router has a complete map of the whole network on the LSDB, each router by itself will run an algorithm to find the best path of each destination network that the router did not know about it. The algorithm that is used on OSPF is called SPF algorithm (also referred to Dijkstra algorithm based on the name of the person who created this algorithm).

The SPF algorithm is very CPU intensive compared to distance vector routing protocols such as RIP, so that is one downside of the Link-state routing protocol.

To make it easier for you to understand the process to finding the best route to destination that OSPF use, think of a navigation system.

If you are driving a car and you have a navigation system, then it has the full map of your whole country. This is LSDB in OSPF.

Say that you want to go from your location to city A, then you put the address of city A (which is similar to a destination network in OSPF) and you click on route. The navigation system will start doing calculation in the background to find for you the best path to reach to that destination address, this is similar to SPF/Dijkstra algorithm which runs in the background on OSPF to find for you the best route to the destination. Finally, once the navigation system finds the best route to city A, he will show it to you on the screen. Similarly, once the SPF algorithm has finished and found the best route to a destination network, he will put that route in the router’s routing table so it can be used in the future to reach that network.

As you can see, the process of OSPF is somehow similar to the navigation system. To mention, the far the destination on the navigation system is, then more time it needs to give you the best route. Same on OSPF, the biggest the network is, then the more time the router needs to find the best path, and that’s why I said that OSPF is CPU intensive.


Submit a Comment

Your email address will not be published. Required fields are marked *

The reCAPTCHA verification period has expired. Please reload the page.

Please Login to Reply or add a comment!