OSPF (Open Shortest Path First) is a dynamic routing protocol. It's a Link-State type that helps find the best path in a network.
To put it more simply, think of OSPF like a GPS:
Imagine you're late for a meeting. You jump in your car, open your GPS, and ask it to find the fastest route. It checks the roads, traffic, and construction zones. Then, it shows you the best route to arrive on time.
Figure 1 – GPS-Based Routing Analogy
That’s exactly how OSPF behaves in your network. It’s like a GPS. It updates its view of the network and finds new routes when things change. Its goal is to always take the shortest and most efficient path to your destination.
Figure 2 – OSPF Path Selection
Just like your GPS finds the best route, OSPF helps PC1 send traffic to PC2 through the best path in our network.
Answer the question below
Before we explore how OSPF works, let’s first look at what kind of protocol it is and how it compares to others.
In a network, routers need a way to learn where different destinations are and how to reach them. They do this by using routing protocols, which fall into two main categories:
Figure 3 – OSPF in the Routing Landscape
EGP vs IGP
EGP (Exterior Gateway Protocol):
helps share routes between organizations. This includes connections between Internet Service Providers and large networks.
Today, the only EGP still in common use is BGP (Border Gateway Protocol).
IGP (Interior Gateway Protocol):
Used inside an organization’s network, between internal routers.
This is where OSPF belongs.
Since OSPF is used within an organization, it's classified as an IGP.
Types of IGPs
Within IGPs, protocols are categorized by how they exchange routing information:
Figure 4 – Types of IGPs
Distance-Vector protocols
Share information only with direct neighbors. Each router makes decisions based on what its neighbors report.
Example: RIPUses hop count as the main metric, fewer hops mean a better path, regardless of link quality.
Link-State protocols
Share detailed link information with all routers in the area. Each router has a synchronized map of the network.
Example: OSPFCalculates the best path based on interface cost, often tied to bandwidth, for more accurate and efficient routing.
Hybrid protocols
Combine characteristics of both Distance-Vector and Link-State.
Example: EIGRPEIGRP communicates with neighbors like Distance-Vector. However, it uses advanced metrics and keeps a partial view of the topology. This makes EIGRP faster and more accurate than RIP.
Answer the question below
Is OSPF classified as an IGP or an EGP?
OSPF Sees the Whole Network
Let’s start with OSPF.
It’s a Link-State protocol, which means every router shares full details about its connected links. This allows each router to build a complete and synchronized map of the network.Once the map is ready, each router runs the Dijkstra algorithm to calculate the shortest paths.
Figure 5 – OSPF Sees the Entire Topology
RIP Has a Limited View
RIP works very differently.
It’s a Distance-Vector protocol, meaning each router only shares its known routes with direct neighbors. Routers then slowly build a view of the rest of the network, hop by hop.Figure 6 – RIP Only Knows Neighbors
Because of these constraints, RIP became too limited for modern networks.
What About EIGRP?
EIGRP is a bit different. It’s considered a hybrid routing protocol, combining features from both Distance-Vector and Link-State:
Like Distance-Vector, it exchanges routing information with neighbors.
But like Link-State, it uses advanced metrics and tracks the state of links more intelligently.
This makes EIGRP faster and more efficient than RIP.
However, there’s one major limitation: EIGRP was originally Cisco proprietary. This means it only works in Cisco-only environments.
That’s why EIGRP is rarely used in multi-vendor networks where interoperability is critical.
In many enterprise networks, OSPF is preferred. This is due to its use of standardized, vendor-neutral protocols.
Summary Table
Protocol
Type
Characteristics
Vendor Support
Typical Use Case
RIP
Distance Vector
Very simple, 15-hop limit
All vendors
Small or legacy networks
EIGRP
Hybrid
Fast convergence, Cisco-only originally
Cisco only
Cisco-specific environments
OSPF
Link-State
Full topology view, open standard
All vendors
Modern enterprise networks
Table 1 - RIP vs EIGRP vs OSPF Comparison
Answer the question below
Just like a GPS constantly updates its map, OSPF routers follow a clear process to keep the network updated and choose the best paths.
This process includes five steps that every OSPF router performs to stay in sync with others and calculate the most efficient routes.Answer the question below
OSPF starts by discovering other routers on the network.
Each router sends Hello packets to let others know it's active.Figure 7 – OSPF Hello Packets and Neighbor Adjacency Formation
If another router receives the Hello packet, it replies to confirm it's also running OSPF.
A neighbor relationship is then formed between them, allowing both routers to share routing information.Answer the question below
What type of packet does OSPF use to discover neighbors?
After neighbors are discovered, routers begin exchanging Link-State Advertisements (LSAs).
Each router sends information about the links it has and the networks it is connected to.Figure 8 – OSPF LSA Exchange
These LSAs are flooded across the entire area, so that every router receives the same information and can build a complete view of the network.
Answer the question below
What information type do OSPF routers flood across the area?
Each router collects all the received LSAs into a structure called the Link-State Database (LSDB).
This database represents the complete network topology from the router’s point of view.Figure 9 – OSPF LSDB Creation
Because all routers receive the same LSAs, their databases are identical.
This keeps the entire OSPF area consistent and synchronized.Answer the question below
What database stores all the LSAs in OSPF?
Once a router has received all LSAs and built its own Link-State Database (LSDB), it runs the Shortest Path First (SPF) algorithm also known as Dijkstra’s algorithm to calculate the best routes to all destinations in the OSPF area.
Figure 10 – OSPF SPF Calculation
The router builds a tree of shortest paths, using itself as the starting point.
This helps it determine the most efficient way to reach every network in the area.Answer the question below
What does SPF stand for in OSPF?
After calculating the shortest paths, the router installs the best routes into its routing table.
Figure 11 – OSPF Routing Table Installation
Thanks to OSPF, the router now knows how to reach each destination network efficiently.
It can then use these routes to forward traffic through the network, depending on what it learns from OSPF.Answer the question below
Let’s recap what you’ve just learned:
Now you know what OSPF is: a dynamic routing protocol that builds a complete and synchronized map of the network.
It forms neighbor relationships, exchanges LSAs, builds a database, calculates optimal routes, and installs them.
It can adapts quickly to changes, using smart communication between routers.
Just like a GPS that constantly reroutes you in traffic, OSPF keeps your network optimized and efficient in real time.
Ready to Practice?
In the next lesson, we’ll move from theory to practice.
You’ll configure OSPF on real routers and see everything you’ve just learned come to life step by step.Let’s get started.
Answer the question below