At first, networking terms like OSPF, areas, neighbors, and routing tables looked complicated.
So in this lab, I decided to build a small network from scratch and understand what is actually happening.
The goal of this lab is simple:
Build a network where PC1 can communicate with PC2 through three routers using OSPF.
1. What is OSPF?
OSPF stands for:
Open Shortest Path First
That sounds complicated, but the basic idea is quite simple.
Imagine three cities connected by roads:
City A ───── City B ───── City C
Each city knows about some roads.
The cities need a way to share information so they can figure out how to reach other cities.
OSPF does something similar with routers.
The routers exchange information about the networks they know.
In our lab:
PC1 → R1 → R2 → R3 → PC2
OSPF helps R1 learn:
"The network where PC2 lives can be reached through R2."
2. What are we building?
Our topology is:
PC1 → R1 → R2 → R3 → PC2
More specifically:
PC1
|
|
R1
|
|
R2
|
|
R3
|
|
PC2
There are three routers between the two computers.
The computers are on different networks.
PC1 is on:
192.168.1.0/24
PC2 is on:
192.168.2.0/24
The routers provide the path between these two networks.
3. Devices used
For this lab, I used:
3 × Cisco 2911 routers
2 × PCs
Copper straight-through cables
Cisco Packet Tracer allows me to build this entire network virtually without needing physical routers.
4. IP Addressing
Before configuring the routers, we need to give each interface an IP address.
Here is our addressing plan:
| Device | Interface | IP Address | Subnet Mask |
|---|---|---|---|
| PC1 | FastEthernet0 | 192.168.1.10 | 255.255.255.0 |
| R1 | G0/0 | 192.168.1.1 | 255.255.255.0 |
| R1 | G0/1 | 10.0.12.1 | 255.255.255.252 |
| R2 | G0/0 | 10.0.12.2 | 255.255.255.252 |
| R2 | G0/1 | 10.0.23.1 | 255.255.255.252 |
| R3 | G0/0 | 10.0.23.2 | 255.255.255.252 |
| R3 | G0/1 | 192.168.2.1 | 255.255.255.0 |
| PC2 | FastEthernet0 | 192.168.2.10 | 255.255.255.0 |
Don't worry if the numbers look confusing.
The important thing to understand is that each interface needs an address so the devices know how to communicate.
5. Configure PC1
Click PC1 → Desktop → IP Configuration.
Enter:
IP Address: 192.168.1.10
Subnet Mask: 255.255.255.0
Default Gateway: 192.168.1.1
The default gateway is R1.
You can think of the default gateway as:
"If I don't know where to send something, give it to this router."
So PC1 sends traffic toward R1.
6. Configure PC2
Click PC2 → Desktop → IP Configuration.
Enter:
IP Address: 192.168.2.10
Subnet Mask: 255.255.255.0
Default Gateway: 192.168.2.1
Now PC2 knows that R3 is its router.
Our network looks like this:
PC1 PC2
192.168.1.10 192.168.2.10
| |
R1 ───────── R2 ───────── R3
| | |
192.168.1.1 10.0.x.x 192.168.2.1
7. Configure R1
Click R1 → CLI.
First enter privileged mode:
enable
Then enter configuration mode:
configure terminal
Give the router a name:
hostname R1
Now configure the interface connected to PC1:
interface gigabitEthernet 0/0
ip address 192.168.1.1 255.255.255.0
no shutdown
exit
Now configure the interface connected to R2:
interface gigabitEthernet 0/1
ip address 10.0.12.1 255.255.255.252
no shutdown
exit
We have now configured R1.
8. Check R1
Run:
show ip interface brief
We want to see:
GigabitEthernet0/0 192.168.1.1 up up
GigabitEthernet0/1 10.0.12.1 up up
The important part is:
up up
This means the interface is working.
9. Configure R2
Now move to R2.
Enter:
enable
configure terminal
hostname R2
Configure the interface connected to R1:
interface gigabitEthernet 0/0
ip address 10.0.12.2 255.255.255.252
no shutdown
exit
Configure the interface connected to R3:
interface gigabitEthernet 0/1
ip address 10.0.23.1 255.255.255.252
no shutdown
exit
R2 is now sitting between R1 and R3:
R1 ───────── R2 ───────── R3
|
middle router
10. Configure R3
On R3:
enable
configure terminal
hostname R3
Configure the interface connected to R2:
interface gigabitEthernet 0/0
ip address 10.0.23.2 255.255.255.252
no shutdown
exit
Configure the interface connected to PC2:
interface gigabitEthernet 0/1
ip address 192.168.2.1 255.255.255.0
no shutdown
exit
Now the basic addressing is complete.
11. Test the router-to-router connections
Before configuring OSPF, it is a good idea to make sure the directly connected routers can communicate.
From R1:
ping 10.0.12.2
R1 should be able to reach R2.
From R2:
ping 10.0.23.2
R2 should be able to reach R3.
If these work, the basic router connections are working.
12. The problem before OSPF
Now imagine PC1 wants to contact PC2.
PC1 has:
192.168.1.10
PC2 has:
192.168.2.10
These are different networks.
PC1 sends the traffic to R1.
But R1 needs to know:
"Where is the 192.168.2.0 network?"
Before we configure a routing protocol, R1 doesn't automatically know that.
This is where OSPF becomes useful.
13. What does OSPF do?
Think of OSPF as a map-sharing system between routers.
R1 knows about:
192.168.1.0
10.0.12.0
R2 knows about:
10.0.12.0
10.0.23.0
R3 knows about:
10.0.23.0
192.168.2.0
OSPF allows them to share this information.
Eventually, R1 learns:
192.168.2.0
and R3 learns:
192.168.1.0
Now the routers know how to reach each other's networks.
14. Configure OSPF on R1
Go to R1.
Enter:
enable
configure terminal
Start OSPF:
router ospf 1
The 1 is the OSPF process ID.
Now tell OSPF which networks R1 should advertise:
network 192.168.1.0 0.0.0.255 area 0
network 10.0.12.0 0.0.0.3 area 0
Then:
end
R1 is now running OSPF.
15. What does area 0 mean?
You will see:
area 0
This is the OSPF area.
For our beginner lab, we are putting everything into:
Area 0
You can think of Area 0 as the main neighborhood in our OSPF network.
For now, we don't need to worry about multiple OSPF areas.
16. Configure OSPF on R2
On R2:
enable
configure terminal
router ospf 1
network 10.0.12.0 0.0.0.3 area 0
network 10.0.23.0 0.0.0.3 area 0
end
R2 now participates in OSPF.
17. Configure OSPF on R3
On R3:
enable
configure terminal
router ospf 1
network 10.0.23.0 0.0.0.3 area 0
network 192.168.2.0 0.0.0.255 area 0
end
Now all three routers are running OSPF.
Our network looks like:
OSPF
↓
R1 ←──────────→ R2 ←──────────→ R3
18. What is an OSPF neighbor?
This is an important concept.
When two routers running OSPF discover each other, they can become OSPF neighbors.
Think of it like two people meeting and saying:
"Hello, I'm R1."
And R2 responds:
"Hello, I'm R2."
They then exchange information about the networks they know.
So:
R1 🤝 R2
means they have formed an OSPF neighbor relationship.
19. Check the OSPF neighbors
On R1, run:
show ip ospf neighbor
You should see R2.
On R2, you should see both R1 and R3.
On R3, you should see R2.
The expected relationships are:
R1 ←→ R2 ←→ R3
This tells us that the OSPF routers are successfully communicating.
20. Check the routing table
Now run on R1:
show ip route
You should see a route marked:
O
For example:
O 192.168.2.0/24
The letter:
O
means:
This route was learned through OSPF.
This is similar to what we saw with EIGRP.
With EIGRP:
D = EIGRP
With OSPF:
O = OSPF
21. Test the complete network
Now comes the exciting part.
Go to PC1.
Open:
Desktop → Command Prompt
Run:
ping 192.168.2.10
PC1 is trying to contact PC2.
The traffic should travel:
PC1
↓
R1
↓
R2
↓
R3
↓
PC2
If you receive replies, congratulations!
You have successfully built a routed network using OSPF.
22. Understanding what just happened
Let's slow down and look at the journey.
PC1 wants to communicate with:
192.168.2.10
PC1 knows that its gateway is:
192.168.1.1
So PC1 sends the traffic to R1.
R1 checks its routing table.
Because of OSPF, R1 has learned:
192.168.2.0/24
R1 knows that the destination can be reached through R2.
So the packet travels:
PC1 → R1 → R2 → R3 → PC2
The reply travels back:
PC2 → R3 → R2 → R1 → PC1
This entire process happens very quickly.
23. Important commands from this lab
These are the commands I used most often.
Check interfaces
show ip interface brief
This tells me whether interfaces are working.
Check OSPF neighbors
show ip ospf neighbor
This tells me whether routers have successfully discovered each other through OSPF.
Check the routing table
show ip route
This shows the router's map of available networks.
Check OSPF information
show ip ospf
This provides information about the OSPF process and areas.
Test connectivity
ping 192.168.2.10
This asks:
"Can I reach PC2?"
24. OSPF vs EIGRP
This was my second dynamic routing lab.
In my previous lab, I used EIGRP.
This time, I used OSPF.
The basic idea is similar:
EIGRP → routers exchange routing information
OSPF → routers exchange routing information
The main difference is that they are different routing protocols and use different methods to calculate and share routes.
For this lab, the important thing is understanding the concept rather than memorizing every detail.
25. What I learned
From this lab, I learned:
How to configure Cisco router interfaces
How to assign IP addresses
How routers communicate with each other
What a routing table is
What OSPF is
How to configure OSPF
What an OSPF neighbor is
How OSPF routers form neighbor relationships
How to verify OSPF neighbors
How to identify OSPF routes using
OHow dynamic routing allows different networks to communicate
How to test connectivity using
ping
26. Final topology
My completed lab looks like this:
OSPF Area 0
PC1 R1 R2 R3 PC2
| | | | |
| | | | |
| 192.168.1.10 | | | 192.168.2.10 |
+────────────────+───────────────+───────────────+────────────────+
| | |
10.0.12.1 10.0.12.2
10.0.23.1 10.0.23.2
The communication path is:
PC1 → R1 → R2 → R3 → PC2
And OSPF provides the routing information needed to make this communication possible.
27. Final result
The final test was:
PC1> ping 192.168.2.10
The ping successfully reached PC2.
That means the network was working across all three routers:
PC1 → R1 → R2 → R3 → PC2
More importantly, I now understand the basic idea behind dynamic routing.
Instead of manually telling every router where every network is, OSPF allows the routers to exchange routing information automatically.
28. What I want to learn next
After learning EIGRP and OSPF, my next Packet Tracer labs will focus on:
VLANs
Inter-VLAN routing
DHCP
Static routes
OSPF troubleshooting
OSPF cost and path selection
Access Control Lists (ACLs)
NAT
Network troubleshooting
AWS networking
The goal is not just to memorize Cisco commands.
The goal is to understand how networks work, why they work, and how to troubleshoot them when they don't.
0 Comments