Free tech learning for everyone, from basics to pro

Networking LabsLabsIntermediate

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

Single-area OSPF labR1 LAN192.168.1.0/24R1RID 1.1.1.1R2RID 2.2.2.2R3RID 3.3.3.3R3 LAN192.168.3.0/24
Figure 1. All three routers and both LANs are in OSPF area 0, with LAN interfaces set as passive.

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.

How OSPF neighbours formHelloevery 10 sTwo-waysee own RIDExchangedatabase summaryLoadingrequest LSAsFulldatabases match
Figure 2. Routers move through these states until their link-state databases match; hellos then keep the adjacency alive.

Steps

  1. Remove any static routes left from the earlier lab.
  2. 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.
  3. Make LAN interfaces passive.
  4. 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/1 shows 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?
The interface network is still advertised, but OSPF stops sending hellos on it, so no neighbour can form there.
Two routers stay in INIT state. What does that suggest?
Each sees hellos from the other, but not its own RID in them, often because of an ACL or one-way communication issue.
What wildcard mask matches the /30 network 10.0.12.0?
0.0.0.3.

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.
Tracks your learning on this device only. See your progress on the learning paths.

About the author

Mohamed Fayas

Founder of FM TecHub. CCNA certified, with a BTEC HND in Network Engineering, and BEng (Hons) in Computer Networking and Cloud Security. He writes practical, plain-English guides on networking, security and cloud.

More about the author

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.

Stay up to date by email

New notes, tools and security news from FM TecHub, explained simply. Free.

We only use your email to send these updates. See our privacy policy.