There are many routing protocols in the networking domain that define a set of rules on how data should be transmitted. Open Shortest Path First (OSPF) is one such dynamic routing protocol. It is called a dynamic protocol as it is able to dynamically exchange routing information between the routers that are the nearest neighbors.
In this blog, we will learn what the OSPF protocol is and how it works. We will also learn about the different states of the OSPF protocol. In the end, we will also discuss the advantages and disadvantages of the protocol.
In the previous blog , we learned about the types of FHRPs in detail. I definitely recommend you go through that blog before jumping to this blog.
Let us now start learning about the OSPF protocol!
Open Shortest Path First (OSPF) is an Interior Gateway Protocol (IGP) that has an algorithm type of Link-State.
This is how a link-state protocol functions:
- When we use a link-state routing protocol, every router creates a ‘connectivity map’ of the network.
- To make this happen, each router advertises information about its interfaces (connected networks) to its neighbors. These advertisements are passed along to other routers until all the other routers in the network develop the same map of the network.
- Therefore, it is very important to note that each of the routers then uses this same map to calculate the best routers for each destination.
- Since more information is shared, link-state protocols use more resources on the router.
- The link-state routers react faster to the changes in the network than the distance vector routers.
Now, let us understand the OSPF in detail:
- If we expand the term OSPF, it is Open Shortest Path First.
- It uses the Shortest Path First algorithm which is also called Dijkstra’s algorithm. This algorithm is named after the name of a Dutch computer scientist.
- There are three versions of OSPF:
- OSPFv1: This is the first version of OSPF created in the year 1989. It is no longer in use.
- OSPFv2: This is the second version of OSPF created in 1998. It is used in IPv4. This version is important for CCNA 200-301.
- OSPFv3: This is the latest version of OSPF created in the year 2008. This version is used for IPv6 and as well as for IPv4.
- The routers store information about networks in Link State Advertisements (LSAs) which are organized in a structure called the Link State Database (LSDB).
- Routers flood the LSAs until all the routers in the OSPF area develop the same map of the network (LSDB).
- This flooding is similar to switches when they receive a broadcast frame or an unknown unicast frame.
- In OSPF, flooding means that they send the LSAs to all of their OSPF neighbors.
How OSPF Works?
The basic functioning of OSPF is carried out through LSA Flooding. As we know by now, the OSPF chooses the shortest path for the routers. The main process involves the sharing of LSAs and determining the best route to each destination.
This is how OSPF works in three main steps:
- The first step is to become neighbors with other routers connected to the same segment.
- Then the routers exchange the Link State Advertisements (LSAs) with neighbor routers.
- After that, each router independently calculates the best routes to each destination. Then it inserts all of these into the routing table.
What are the Different States of OSPF?
The network devices that use the OSPF protocol undergo certain states. The various states of OSPF are as follows:
No “Hello” packets are received on the interface in the down state. The downstate means that the OSPF adjacency process has not begun yet.
The “Hello” packets are received from other routers in the INIT state.
In this state, a bidirectional connection is formed. Both routers receive “Hello” packets from other routers.
In this state, the exchange of NULL DBD takes place. Similar to the First Hop Redundant Protocol (FHRP), the election of the master and slave router occurs. The router with the higher router ID becomes the master while the router with the lower router ID becomes the slave. This decides which router sends the DBD first.
The actual DBDs are exchanged in this state.
The Link State Advertisements (LSAs) along with LSUs and LSRs are exchanged in this state.
All the information is synced in this state. It is only after the Full state that the OSPF routing begins!
Therefore, there are a total of seven states of OSPF that the routers undergo before the actual OSPF routing begins.
What are the Advantages of OSPF?
The following are the major advantages of the OSPF protocol:
- OSPF can be configured on both IPv4 and IPv6 versions of IPs.
- It can carry out load balancing.
- It uses the SPF algorithm to present a loop-free technology.
- It is not Cisco proprietary. It can run on many routers.
- It is a classless protocol.
- It has unlimited hop counts.
- It works very fast.
What are the Disadvantages of OSPF?
The following are the disadvantages of the OSPF protocol:
- It needs extra storage. Therefore, it means that it needs an extra CPU process to run the SPF algorithm.
- It needs more RAM to save adjacency topology.
- It is very complex. Therefore, it’s very difficult to troubleshoot.
This marks the end of the OSPF blog. So far, we have learned what the OSPF protocol is and why it is called a Link-State Protocol. We have also understood the working of the protocol.
Then, we learned the different states the routers undergo before the actual OSPF process begins. At last, we looked over the advantages and disadvantages of the OSPF protocol.
Stay tuned for learning more protocols such as BGP, EIGRP, and RIP in the CCNA series
1 thought on “What is Open Shortest Path First (OSPF) in Networking?”