Lab: single-area OSPF on three routers
In short: Open Shortest Path First (OSPF) is a link-state routing protocol that builds routes automatically. In this lab you enable OSPF in a single area on three routers, set router IDs and passive interfaces, share a default route, and check neighbours and routes.
Aim and what you need
The aim is to let routers learn routes from each other instead of you typing them. Open Shortest Path First version 2 (OSPFv2) is the most widely used interior routing protocol in enterprise networks, and single-area OSPF is a core CCNA skill.
- The three-router topology from the static routing lab, with addresses but no static routes.
- Packet Tracer or three routers in your own lab.
Topology
Each router gets a fixed router ID (RID) so you can recognise it easily in output. LAN interfaces are made passive: OSPF still advertises those networks, but sends no hello packets to the PCs, which is both tidier and safer.
Steps
- Remove any static routes left from the earlier lab.
- Start the OSPF process, set the router ID and add each connected network to area 0. A wildcard mask of 0.0.0.3 matches a /30; check others with the wildcard calculator.
- Make LAN interfaces passive.
- On R2 (for the test), add a loopback to represent an internet link and advertise a default route into OSPF.
! R1
router ospf 1
router-id 1.1.1.1
network 192.168.1.0 0.0.0.255 area 0
network 10.0.12.0 0.0.0.3 area 0
passive-interface g0/0
! R2
router ospf 1
router-id 2.2.2.2
network 10.0.12.0 0.0.0.3 area 0
network 10.0.23.0 0.0.0.3 area 0
! R3
router ospf 1
router-id 3.3.3.3
network 10.0.23.0 0.0.0.3 area 0
network 192.168.3.0 0.0.0.255 area 0
passive-interface g0/1
As an alternative to network statements, you can enable OSPF directly on each interface. Both methods are valid; do not mix them on one interface.
interface g0/1
ip ospf 1 area 0
Default route test on R2:
interface loopback0
ip address 203.0.113.1 255.255.255.255
exit
ip route 0.0.0.0 0.0.0.0 loopback0
router ospf 1
default-information originate
Verify
Success looks like this: R2 lists two neighbours in the FULL state; R1 and R3 each show one. Routes learned from OSPF appear with an O, and the default route on R1 and R3 appears as O*E2. PC-A should reach PC-C.
show ip ospf neighbor
show ip route ospf
show ip protocols
show ip ospf interface brief
show ip ospf database
Then shut one inter-router link and watch the neighbour disappear and the route vanish within the dead interval (40 seconds by default on Ethernet). That is OSPF reacting to topology change, which static routes cannot do.
Troubleshooting and clean-up
- No neighbours: check both ends are in the same subnet and area, with matching hello and dead timers.
show ip ospf interface g0/1shows the timers. - Passive by mistake: if an inter-router link is passive, no adjacency forms. Check
show ip protocols. - Duplicate router IDs: copy-pasting configs can repeat a RID. Fix it, then run
clear ip ospf process. - Stuck in EXSTART or EXCHANGE on real kit: usually an MTU mismatch between the two interfaces.
- Network missing: a wrong wildcard mask means the interface was never added.
To clean up, remove the process with no router ospf 1. At work, also consider OSPF authentication (for example HMAC-SHA keys) so that rogue routers cannot inject routes, and always set router IDs explicitly so logs are easy to read.
Practice
What does passive-interface change?
Two routers stay in INIT state. What does that suggest?
What wildcard mask matches the /30 network 10.0.12.0?
Key takeaways
- OSPF is a link-state protocol; neighbours exchange LSAs to build identical databases.
- Set router IDs manually and put all interfaces in area 0 for a single-area design.
- Make LAN-facing interfaces passive.
- default-information originate shares a default route with the area.
- Check neighbours first: same subnet, area, timers and MTU.
Original content written by Mohamed Fayas for FM TecHub. © 2026 FM TecHub. You're welcome to share a link to this page; please don't copy the text elsewhere without permission.