Static routes scale to about three routers before they stop being fun. Past that, every new subnet means logging into every router and adding another line — and forgetting one means a black hole that takes 20 minutes to find. Dynamic routing exists so the routers learn the topology themselves and adapt when something changes.

OSPF (Open Shortest Path First) is the link-state IGP the CCNA exam centres on. Each router builds a complete map of the area, runs Dijkstra's algorithm against it, and installs the shortest path to every known network. When a link dies, every router in the area is told within seconds and the table reconverges — no waiting, no manual intervention.

This lab stands up OSPFv2 single-area (area 0) across a multilayer switch and one router in Packet Tracer. Four LANs get advertised: three PC segments hanging off the layer-3 switch, one /16 server segment off the router. When it's working, a ping from PC1 to a server in the 172.20.0.0/16 LAN traverses two devices it has never been told about — and just works.

OSPF single-area lab topology in Packet Tracer — three PCs each on a layer-3 routed port of a multilayer switch (DSW), DSW uplinking to a single router R1, R1 facing a server segment with two servers. Area 0 (Backbone) covers the entire diagram.
[ FIG 1 — OSPF lab topology shipped with the .pkt file. Everything is in area 0. ]

★ WHY OSPF / IS-IS

OSPF and IS-IS are the two link-state IGPs that run real networks. Different mechanics under the hood — IS-IS rides directly on layer 2, OSPF on IP — but the algorithm (Dijkstra) and the design philosophy are the same. Almost every enterprise network uses one. Almost every ISP backbone uses the other. The CCNA tests OSPF, but the moment you understand it, IS-IS is a weekend's worth of vocabulary away.

[ DISTANCE-VECTOR vs LINK-STATE ]

Distance-vector (RIP, EIGRP)

Routers gossip their tables. "I can reach 192.168.1.0 in 3 hops, ask me." Nobody ever sees the full map — they trust their neighbour's summary.

Link-state (OSPF, IS-IS)

Every router floods a description of its own links. Every router builds the same complete map, then independently runs Dijkstra and picks shortest paths. Faster convergence, loop-free by construction, scales to thousands of devices via areas.

★ KEY OSPF CONCEPTS — ALL TESTED

Five vocabulary items show up on every OSPF question. Worth pinning before you touch the CLI.

[ PROCESS ID ]

Locally significant. router ospf 1 on one router and router ospf 99 on another still form a neighbourship. Don't confuse it with AS or area number.

[ ROUTER-ID ]

A 32-bit identifier in dotted-decimal. Manually pinned, or auto-picked from the highest loopback, then highest physical interface. Always pin it manually so it stays predictable across reboots.

[ AREA ]

Administrative grouping for LSDB scope. Single-area means everything sits in area 0 (the backbone). Multi-area is a Day-2 design topic — out of scope here.

[ WILDCARD MASK ]

Inverse of a subnet mask. Subtract each octet from 255.

/30 → 0.0.0.3
/29 → 0.0.0.7
/28 → 0.0.0.15
/24 → 0.0.0.255
/16 → 0.0.255.255

[ ADJACENCY ]

Two OSPF speakers that have exchanged Hello packets, agreed on parameters, and synced their LSDBs. Healthy state = FULL. Anything else means broken.

★ IP ADDRESSING TABLE

DEVICE INTERFACE IP / MASK ROLE
DSWFa0/1 (no switchport)172.16.0.1/16↔ R1 g0/0/0
DSWFa0/2 (no switchport)192.168.1.254/24GW for PC1
DSWFa0/3 (no switchport)192.168.2.254/24GW for PC2
DSWFa0/4 (no switchport)192.168.3.254/24GW for PC3
R1Gi0/0/0172.16.0.2/16↔ DSW Fa0/1
R1Gi0/0/1172.20.255.254/16GW for servers
PC1NIC192.168.1.10/24  GW 192.168.1.254DSW Fa0/2 LAN
PC2NIC192.168.2.10/24  GW 192.168.2.254DSW Fa0/3 LAN
PC3NIC192.168.3.10/24  GW 192.168.3.254DSW Fa0/4 LAN
Server1NIC172.20.0.100/16  GW 172.20.255.254R1 Gi0/0/1 LAN
Server2NIC172.20.0.200/16  GW 172.20.255.254R1 Gi0/0/1 LAN
[ HOW THE GATEWAY ADDRESSES WERE PICKED ]

Every host-side LAN uses the last usable address as the gateway — .254 on the /24 PC LANs, .255.254 on the /16 server segment. A common convention — easy to remember and leaves the low addresses for static infrastructure.

★ STEP 1 — DSW (THE MULTILAYER SWITCH)

DSW is the layer-3 boundary for the user side. It has no VLANs in this lab — instead, every PC-facing port is a routed (no switchport) interface with its own /24, and the uplink to R1 is another routed port on a /16. ip routing turns the box from a switch into a switch-with-routing.

DSW> enable DSW# configure terminal DSW(config)# hostname DSW ! Without this, DSW is just a layer-2 switch DSW(config)# ip routing ! Uplink to R1 DSW(config)# interface fa0/1 DSW(config-if)# no switchport DSW(config-if)# ip address 172.16.0.1 255.255.0.0 DSW(config-if)# no shutdown DSW(config-if)# exit ! PC1 segment DSW(config)# interface fa0/2 DSW(config-if)# no switchport DSW(config-if)# ip address 192.168.1.254 255.255.255.0 DSW(config-if)# no shutdown DSW(config-if)# exit ! PC2 segment DSW(config)# interface fa0/3 DSW(config-if)# no switchport DSW(config-if)# ip address 192.168.2.254 255.255.255.0 DSW(config-if)# no shutdown DSW(config-if)# exit ! PC3 segment DSW(config)# interface fa0/4 DSW(config-if)# no switchport DSW(config-if)# ip address 192.168.3.254 255.255.255.0 DSW(config-if)# no shutdown DSW(config-if)# exit
[ ⚠ NO SWITCHPORT MEANS NO L2 ]

A routed port behaves like a router interface — it has an IP, it doesn't participate in VLANs, and you can't trunk it. If you ever need it back as an L2 port, switchport on the interface flips it back.

★ STEP 2 — R1 (THE ROUTER)

One router with two interfaces. Gi0/0/0 faces DSW, Gi0/0/1 faces the server segment.

Router> enable Router# configure terminal Router(config)# hostname R1 ! Toward DSW R1(config)# interface gi0/0/0 R1(config-if)# ip address 172.16.0.2 255.255.0.0 R1(config-if)# no shutdown R1(config-if)# exit ! Toward the server segment R1(config)# interface gi0/0/1 R1(config-if)# ip address 172.20.255.254 255.255.0.0 R1(config-if)# no shutdown R1(config-if)# exit

Sanity-check the L1/L2/IP layer before turning on OSPF.

R1# ping 172.16.0.1 ! should hit DSW Fa0/1 DSW# ping 172.16.0.2 ! should hit R1 Gi0/0/0

If either ping fails, fix that first — OSPF will never come up over a broken link.

★ STEP 3 — TURN ON OSPF

Two devices run OSPF: DSW and R1. Each gets a process number, a router-ID, and a list of which directly-connected networks to advertise into area 0.

! ----- DSW ----- DSW(config)# router ospf 1 DSW(config-router)# router-id 10.10.10.10 ! Advertise the uplink to R1 and all three PC LANs DSW(config-router)# network 172.16.0.0 0.0.255.255 area 0 DSW(config-router)# network 192.168.1.0 0.0.0.255 area 0 DSW(config-router)# network 192.168.2.0 0.0.0.255 area 0 DSW(config-router)# network 192.168.3.0 0.0.0.255 area 0 ! No OSPF neighbours hang off the PC ports — silence them DSW(config-router)# passive-interface fa0/2 DSW(config-router)# passive-interface fa0/3 DSW(config-router)# passive-interface fa0/4 DSW(config-router)# exit
! ----- R1 ----- R1(config)# router ospf 1 R1(config-router)# router-id 1.1.1.1 ! Advertise the uplink to DSW and the server segment R1(config-router)# network 172.16.0.0 0.0.255.255 area 0 R1(config-router)# network 172.20.0.0 0.0.255.255 area 0 ! Servers don't speak OSPF — silence the server-facing port R1(config-router)# passive-interface gi0/0/1 R1(config-router)# exit

WHAT EACH PIECE DOES

[ router ospf 1 ]

Starts an OSPF process. The "1" is the process ID — locally significant, doesn't have to match across devices.

[ router-id x.x.x.x ]

Pins the router's identity. Without this, IOS picks the highest interface IP, which can drift if you bring an interface up or down. Pinning keeps the LSDB stable.

[ network … area 0 ]

"Any of my interfaces falling inside this range — send Hellos out and advertise into area 0." The wildcard mask matches the interface IP.

0.0.0.255 matches a /24
0.0.255.255 matches a /16

[ passive-interface ]

Keeps advertising the network into OSPF, but stops sending Hello packets out that interface. PCs and servers don't speak OSPF, so silencing host-facing ports saves CPU and shaves the attack surface (BPDUs / Hellos shouldn't leak onto user LANs).

★ STEP 4 — VERIFY THE ADJACENCY

Within seconds of OSPF coming up on both sides, you should see a neighbour-up console message. Confirm it.

DSW# show ip ospf neighbor ! Expect 1 neighbour: ! Neighbor ID Pri State Address Interface ! 1.1.1.1 1 FULL/DR 172.16.0.2 FastEthernet0/1 R1# show ip ospf neighbor ! Expect 1 neighbour: ! Neighbor ID Pri State Address Interface ! 10.10.10.10 1 FULL/BDR 172.16.0.1 GigabitEthernet0/0/0

One link, one adjacency from each side. Both should sit at FULL.

[ ⚠ STUCK BEFORE FULL ]

INIT

One side is hearing Hellos, the other isn't replying. Check the network statement and wildcard mask on the silent side.

EXSTART / EXCHANGE

Adjacency stuck during the database descriptor exchange. Almost always an MTU mismatch — or duplicate router-IDs. Run show ip ospf interface on both ends and compare MTU.

2-WAY ONLY

Expected on a multi-access segment for non-DR/BDR routers. On a point-to-point link like this one, it indicates a problem.

★ STEP 5 — VERIFY THE ROUTING TABLES

Each device should have learned every network it isn't directly connected to. Routes show up tagged O (intra-area OSPF).

DSW# show ip route ospf ! Expect 1 route: ! O 172.20.0.0/16 [110/2] via 172.16.0.2, FastEthernet0/1 R1# show ip route ospf ! Expect 3 routes: ! O 192.168.1.0/24 [110/2] via 172.16.0.1, GigabitEthernet0/0/0 ! O 192.168.2.0/24 [110/2] via 172.16.0.1, GigabitEthernet0/0/0 ! O 192.168.3.0/24 [110/2] via 172.16.0.1, GigabitEthernet0/0/0

110 is OSPF's administrative distance — same on every Cisco router. The number after the slash is the cost (default = 100M / interface bandwidth, accumulated along the path).

! Look at the LSDB itself show ip ospf database ! Per-interface OSPF parameters (state, cost, neighbours, MTU) show ip ospf interface ! Process-level health show ip ospf

★ STEP 6 — END-TO-END VERIFICATION

The whole point. From PC1, ping each server.

PC> ping 172.20.0.100 ! Server1 PC> ping 172.20.0.200 ! Server2 ! First ping may show one timeout (ARP resolution), ! then 4/4 or 3/4 replies. Subsequent pings: 4/4.

Repeat from PC2 and PC3, then trace the path to confirm OSPF picked the route you expect.

PC> tracert 172.20.0.100 ! Expect 3 hops: ! 1 192.168.1.254 (DSW Fa0/2 — your default gateway) ! 2 172.16.0.2 (R1 Gi0/0/0) ! 3 172.20.0.100 (Server1)
[ ✓ THE WHOLE POINT ]

No static routes were configured anywhere. DSW learned the server segment from R1; R1 learned the three PC LANs from DSW. Plug in a fifth LAN tomorrow, advertise it, and the other device knows about it within seconds — no touching anything else.

★ THINGS WORTH TRIGGERING

This topology has a single path between the two ends, so dramatic reconvergence demos aren't on the menu — for that, see Lab 4 (RSTP) on the L2 side, or extend this lab with a second router. What you can still poke at:

[ SHUT THE UPLINK ]

From DSW, interface fa0/1 + shutdown. Adjacency drops, both routing tables lose their OSPF entries within seconds. no shutdown brings them back. Watch show ip ospf neighbor in real time.

[ CHANGE THE COST ]

ip ospf cost 50 on an interface, then re-check show ip route ospf. The metric changes; the path doesn't (only one option). Useful to see how cost propagates in LSAs.

[ CHURN THE ROUTER-ID ]

no router-id 1.1.1.1 on R1, then commit a new ID and run clear ip ospf process. Adjacency tears down and re-forms — useful for seeing how the LSDB rebuilds from scratch.

[ MISMATCH HELLO/DEAD TIMERS ]

ip ospf hello-interval 5 on one side of the link only. Adjacency drops and won't re-form — Hello/Dead agreement is mandatory. Restore symmetry to bring it back. Common real-world bug, worth experiencing once.

[ EXTEND THE TOPOLOGY ]

Drop a second router (R2) between R1 and the server segment, give it a /16 link to R1, and bring it into area 0. Now you have a real multi-router LSDB and can trigger genuine reconvergence by shutting the R1↔R2 link.

★ COMMON GOTCHAS

[ ⚠ FORGOT IP ROUTING ON DSW ]

Symptom: Each PC can ping its own gateway and other PCs on the same /24, but nothing else. OSPF won't even start.

Fix: ip routing in global config on DSW. The 3560 needs this to forward between L3 interfaces.

[ ⚠ WILDCARD INVERSION ]

Symptom: Adjacency never forms. No console message. show ip ospf interface brief shows the interface as not running OSPF.

Cause: Typed a subnet mask in the network statement instead of a wildcard. 255.255.0.0 doesn't match anything; 0.0.255.255 matches the /16. IOS accepts both syntactically — it just silently matches nothing.

Fix: Subtract each octet from 255 before typing.

[ ⚠ MISSING NETWORK STATEMENT ]

Symptom: OSPF runs on the link itself, but a LAN behind one of your interfaces never appears in the other device's routing table.

Fix: show ip protocols lists every active network statement on the device. Cross-reference against your interfaces — every IP that should be in OSPF must be matched by exactly one network statement.

[ ⚠ MTU MISMATCH HANGS EXSTART ]

Symptom: Neighbour state oscillates between EXSTART and EXCHANGE forever. Never reaches FULL.

Cause: The two ends disagree on IP MTU. The DBD packet exchange refuses to complete on a mismatch.

Fix: ip ospf mtu-ignore on the interface (lab-grade fix), or set the actual MTU equal on both sides (production fix).

★ VERIFICATION CHEAT SHEET

! Adjacency — should be FULL on every link show ip ospf neighbor ! Routes learned via OSPF — marked 'O' show ip route ospf ! Per-interface OSPF state, cost, neighbours, MTU show ip ospf interface ! Process-level — area, neighbour count, SPF count show ip ospf ! The link-state database itself show ip ospf database ! Network statements active in each process show ip protocols ! Real-time troubleshooting (heavy — turn off when done) debug ip ospf adj debug ip ospf hello undebug all

★ LAB DOWNLOAD

Built and tested in Packet Tracer 8.x. PCs and servers ship pre-addressed; routing config is yours to build. Run the steps in order and you'll have OSPF up in roughly 15 minutes.

► PACKET TRACER LAB — OSPF SINGLE-AREA 1 multilayer switch · 1 router · 3 PC LANs · 1 server segment
Pre-addressed PCs and servers, OSPF config is yours to build
INTERMEDIATE FREE PACKET TRACER
⬇ DOWNLOAD .PKT
[ ★ STUDY RESOURCES ]