🌐 OSPF (Open Shortest Path First)
OSPF is a link-state dynamic routing protocol that automatically exchanges routing information between routers and calculates the shortest path using the SPF algorithm.
This is dynamic routing.
Until now in static routing:
👉 You manually added routes.
Now with OSPF:
👉 Routers automatically learn routes from each other.
This is heavily used in:
- Enterprise networks
- ISPs
- Data centers
- Corporate environments
🎯 What You Will Learn
- ✔ Dynamic route learning
- ✔ Neighbor relationships
- ✔ Route advertisement
- ✔ Automatic path selection
- ✔ Scalable routing
🔥 Difference: Static vs OSPF
🧪 Practical Topology
In Cisco Packet Tracer create:
PC0 --- R1 --- R2 --- R3 --- PC1
🌐 IP Addressing Plan
🔹 LAN Networks
🔹 Router-to-Router Links
🔌 Wiring (IMPORTANT)
PC Connections
Router Connections
⚙️ Step 1: Configure Router Interfaces
🔹 Router1
enable configure terminal interface g0/0 ip address 10.0.0.1 255.255.255.0 no shutdown interface g0/1 ip address 192.168.1.1 255.255.255.252 no shutdown
🔹 Router2
enable configure terminal interface g0/0 ip address 192.168.1.2 255.255.255.252 no shutdown interface g0/1 ip address 192.168.2.1 255.255.255.252 no shutdown
🔹 Router3
enable configure terminal interface g0/0 ip address 192.168.2.2 255.255.255.252 no shutdown interface g0/1 ip address 20.0.0.1 255.255.255.0 no shutdown
⚙️ Step 2: Configure PCs
PC0
IP: 10.0.0.10
Gateway: 10.0.0.1
PC1
IP: 20.0.0.10
Gateway: 20.0.0.1
❌ Test Before OSPF
From PC0:
ping 20.0.0.10
❌ Fail
Because routers don’t know remote networks yet.
🔥 Step 3: Configure OSPF
🔹 Router1
router ospf 1 network 10.0.0.0 0.0.0.255 area 0 network 192.168.1.0 0.0.0.3 area 0

🔹 Router2
router ospf 1 network 192.168.1.0 0.0.0.3 area 0 network 192.168.2.0 0.0.0.3 area 0
🔹 Router3
router ospf 1 network 192.168.2.0 0.0.0.3 area 0 network 20.0.0.0 0.0.0.255 area 0
🧠 Important Concept
What is Area 0?
👉 Backbone area of OSPF
All routers communicate inside Area 0.
🔥 Step 4: Verify Neighbor Relationship
Run:
show ip ospf neighbor
You should see neighboring routers.
🔥 Step 5: Verify Routing Table
Run:
show ip route
You’ll see routes marked:
O
👉 Means learned through OSPF
🧪 Final Test
From PC0:
ping 20.0.0.10
✔ SUCCESS
















































