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
Click 'Complete' to continue
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 because it is a standardized, vendor-neutral protocol.
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
What type of routing protocol is OSPF described as in this section?
OSPF is not magic.
Every router follows the same structured process.Think of it as a 5-phase cycle that runs continuously inside the network.
Answer the question below
Click 'Complete' to continue
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.Try It Yourself
Now let's quickly verify this on a real router.
On R1, type:R1# show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 2.2.2.2 1 FULL 00:00:31 192.168.1.2 Gi0/0 3.3.3.3 1 FULL 00:00:34 192.168.2.2 Gi0/1You don't need to understand every column yet.
For now, just check one thing:
If you see the word FULL, it means the neighbor relationship has been successfully established.That's it.
Once both neighbors are in FULL state, R1 is ready to exchange routing information with them.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.
This is what makes OSPF different from distance-vector protocols.
Instead of only sharing routes with neighbors, OSPF shares detailed topology information with all routers in the area.Try It Yourself
Now let's verify that LSAs are being exchanged.
On R1, type:R1# show ip ospf database OSPF Router with ID (1.1.1.1) Router Link States (Area 0) Link ID ADV Router Age Seq# Checksum 1.1.1.1 1.1.1.1 120 0x80000003 0x00A1 2.2.2.2 2.2.2.2 118 0x80000002 0x00B4 3.3.3.3 3.3.3.3 119 0x80000002 0x00C8 4.4.4.4 4.4.4.4 117 0x80000002 0x00D2You don't need to understand every column yet.
For now, just notice this:R1 can see LSAs coming from:
1.1.1.1 (itself)
2.2.2.2 (R2)
3.3.3.3 (R3)
4.4.4.4 (R4)
That means LSAs are being exchanged and flooded correctly.
At this point, all routers in Area 0 are sharing their topology information.This is the foundation of OSPF.
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).
The LSDB is basically the router's internal map of the network.
Figure 9 – OSPF LSDB Creation
Each router's LSAs are flooded, neighbor to neighbor, to every router in the area, so every router builds an identical database.
At this stage:
R1 knows about R2, R3 and R4
R2 knows about R1, R3 and R4
R3 knows about R1, R2 and R4
R4 knows about R1, R2 and R3
All routers now share the same synchronized view of Area 0.
This is a key difference from distance-vector protocols:
every router has the full topology map, not just partial route information.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
This is where the router calculates the best paths using the complete topology information stored in the LSDB.
The router builds a shortest-path tree with itself as the root, and determines:
The best path to each network
The outgoing interface
The next-hop router
This process happens automatically every time the topology changes.
Try It Yourself
Let's verify that SPF has executed on R1.
On R1, type:R1# show ip ospf Routing Process "ospf 1" with ID 1.1.1.1 Supports only single TOS(TOS0) routes Supports opaque LSA SPF schedule delay 5 secs, Hold time between two SPFs 10 secs Minimum LSA interval 5 secs. Minimum LSA arrival 1 secs Number of external LSA 0. Checksum Sum 0x000000 Number of areas in this router is 1. 1 normal 0 stub 0 nssa SPF algorithm executed 4 timesYou don't need to understand every line.
Just look at the green line.This confirms that R1 has run the SPF calculation to determine the best paths.
If a link goes down or a new router appears, this number increases, because OSPF recalculates the topology.Answer the question below
What does SPF stand for in OSPF?
After running the SPF algorithm, the router selects the best paths and installs them into its routing table.

Figure 11 – OSPF Routing Table Installation
This is the final result of the entire OSPF process.
At this stage:
Neighbor relationships are established
LSAs have been exchanged
The LSDB has been built
SPF has calculated the shortest paths
Now, those best paths are written into the routing table so the router can actually forward traffic.
Try It Yourself
Let's verify that R1 has installed OSPF routes.
On R1, type:R1# show ip route ospf O 192.168.3.0/24 [110/2] via 192.168.2.2, 00:00:22, GigabitEthernet0/1 O 192.168.4.0/24 [110/2] via 192.168.1.2, 00:00:25, GigabitEthernet0/0 O 192.168.20.0/24 [110/2] via 192.168.1.2, 00:00:25, GigabitEthernet0/0You don't need to analyze every field yet.
Just notice two things:
• The routes start with O → this means they were learned via OSPF
• R1 now knows how to reach remote networksThat's the key.
These routes are the direct result of the SPF calculation.Now R1 can forward traffic toward those networks using the best available paths.
Answer the question below
Which letter at the start of a routing-table entry shows the route was learned via OSPF?
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 adapt 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
Click 'Complete' to continue