Course contents

Module 5: PracticeLesson 5.1 (1 of 5 in this module)17 of 29 in the OSPF course

Lab: single-area OSPF on three routers

Can PC-1 reach the server without a static route for every remote LAN? Let's configure OSPF, prove the route in both directions and then diagnose one deliberate fault at a time.

Intermediate · 25 min read

What should work when we finish?

These are the three routers from the static routing lab. This time, replace static routes with OSPF so that a new LAN is learned automatically. OSPFv2 exchanges IPv4 routing information. A single-areadesign puts all participating interfaces in one area, area 0 here. Each router uses the shared area topology information to calculate its own routes. Every listed interface is addressed and up before this lab. R1 already has a static default route to the ISP (ip route 0.0.0.0 0.0.0.0 203.0.113.1); no other static routes or routing protocols remain. Save a separate copy of your earlier static-routing exercise rather than overwriting it. Use an isolated Cisco IOS or IOS XE lab image, or Packet Tracer where these commands are supported. Paper practice can predict output but cannot verify execution.

PC-1 is 192.168.1.10/24 with default gateway 192.168.1.1. PC-2 is 192.168.2.10/24 with gateway 192.168.2.1. The server is 192.168.3.10/24 with gateway 192.168.3.1. Our first goal is a ping from PC-1 to that server and back. These are IP addresses, not website URLs; no DNS lookup or web application is required for this test.

RouterInterfaceAddressConnects to
R1Gi0/0192.168.1.1/24LAN 1
Gi0/110.0.12.1/30R2
Gi0/2203.0.113.2/30ISP (203.0.113.1)
R2Gi0/010.0.12.2/30R1
Gi0/110.0.23.1/30R3
Gi0/2192.168.2.1/24LAN 2
R3Gi0/010.0.23.2/30R2
Gi0/1192.168.3.1/24LAN 3 (server 192.168.3.10)

Gi abbreviates GigabitEthernet. The /24 mask is 255.255.255.0; /30 is 255.255.255.252. The router IDs 1.1.1.1, 2.2.2.2 and 3.3.3.3 name the OSPF routers. They do not replace the interface addresses used to reach a neighbour.

The ISP link remains outside OSPF. R1 advertises a default route, meaning a route for destinations without a more-specific match. Reaching the ISP router alone does not prove internet access. An actual external test also needs an external target, provider return routing and any required NAT, none of which is built by this exercise.

Task 1: plan which interfaces run OSPF

Before typing anything, decide for each interface: does it run OSPF, and should it be passive? Pick the router IDs and the area. Then decide whether the router-to-router links need a DR.

What to plan
What to planDecide which interfaces run OSPF.Plan the labInterfacesrouter links and LANsPassiveLANs that need noneighboursRouter IDunique on each router

On small screens, swipe sideways or focus the diagram and use the arrow keys.

Plan before typing commands.
Show the plan
Task 1: plan which interfaces run OSPF
Task 1: plan which interfaces run OSPFInterface; OSPF?; Passive?; Why. LAN interfaces (R1 Gi0/0, R2 Gi0/2, R3 Gi0/1): Yes Yes The LAN must be advertised, but no router lives there, so no hellos. Router links (10.0.12.0/30, 10.0.23.0/30): Yes No Neighbours form here. R1 Gi0/2 to the ISP: No – OSPF doesn't run towards the ISP. R1 advertises a default route instead.InterfaceOSPF?Passive?WhyLAN interfaces (R1Gi0/0, R2 Gi0/2,R3 Gi0/1)YesYesThe LAN must beadvertised, but no routerlives there, so nohellos.Router links(10.0.12.0/30,10.0.23.0/30)YesNoNeighbours form here.R1 Gi0/2 to theISPNo–OSPF doesn't run towardsthe ISP. R1 advertises adefault route instead.

On small screens, swipe sideways or focus the diagram and use the arrow keys.

Read each row across: the left box names the item, the others describe it.

Router IDs 1.1.1.1, 2.2.2.2 and 3.3.3.3, everything in area 0. Each /30 link has only two routers, so set the network type to point-to-point on both ends. A designated router (DR) helps coordinate OSPF information on a shared network. It is unnecessary on these two-router links, so this network type removes the election.

Task 2: configure the three routers

Enter configure terminal from privileged EXEC mode on the named router. Each block below starts in global configuration mode. The interface commands set the link type; the router commands create process 1 and select participating interfaces. Set the router ID before the network statements enable OSPF on those interfaces.

Configure in order
Configure in orderSame steps on each router.Router IDset by handNetworksinto area 0Passiveon the LANsSavecopy run start

On small screens, swipe sideways or focus the diagram and use the arrow keys.

Keep configurations consistent.

A network statement matches local interface addresses, not remote networks to be learned. Its wildcard mask marks which address bits may vary: 0.0.0.3 matches this /30, while 0.0.0.255 matches the /24. A passive interface still contributes its selected LAN to OSPF but does not send Hellos or build neighbours there.

Show the configuration
interface GigabitEthernet0/1 ip ospf network point-to-point ! router ospf 1 router-id 1.1.1.1 auto-cost reference-bandwidth 10000 passive-interface GigabitEthernet0/0 network 192.168.1.0 0.0.0.255 area 0 network 10.0.12.0 0.0.0.3 area 0 default-information originate

R1. No network statement matches 203.0.113.2, so OSPF stays off the ISP link. default-information originate advertises the existing static default route.

interface GigabitEthernet0/0 ip ospf network point-to-point interface GigabitEthernet0/1 ip ospf network point-to-point ! router ospf 1 router-id 2.2.2.2 auto-cost reference-bandwidth 10000 passive-interface GigabitEthernet0/2 network 10.0.12.0 0.0.0.3 area 0 network 10.0.23.0 0.0.0.3 area 0 network 192.168.2.0 0.0.0.255 area 0

R2: two router links and one passive LAN.

interface GigabitEthernet0/0 ip ospf network point-to-point ! router ospf 1 router-id 3.3.3.3 auto-cost reference-bandwidth 10000 passive-interface default no passive-interface GigabitEthernet0/0 network 10.0.23.0 0.0.0.3 area 0 network 192.168.3.0 0.0.0.255 area 0

R3, written the other way round: everything passive, then hellos switched back on towards R2.

The same reference bandwidth on all three routers keeps their costs comparable: 10 for each gigabit interface.

The transit interfaces must exchange Hellos; the host LANs must be advertised without building host-side neighbours. The reference bandwidth is 10 000 Mbps on every router. A gigabit interface with configured bandwidth 1000 Mbps therefore has cost 10, unless an explicit interface cost overrides it.

default-information originate requests an external default advertisement from R1 while R1 has an installed default route. It does not enable OSPF towards the ISP, and the existence of that static route is not an application-health check.

Task 3: verify, bottom-up

Check neighbours first, then routes. On R2 you expect two neighbours, both Full:

Verify bottom-up
Verify bottom-upCheck each layer before the next.show ip interface briefInterfaces up and addressedshow ip ospf neighborFULL on each linkshow ip ospf databaseSame LSAs on each routershow ip route ospfRoutes to every LAN

On small screens, swipe sideways or focus the diagram and use the arrow keys.

Interface first, routes last.
Example output written for this lab, based on Cisco IOS documentation
R2#show ip ospf neighbor
Neighbor ID     Pri   State           Dead Time   Address         Interface
3.3.3.3           0   FULL/  -        00:00:35    10.0.23.2       GigabitEthernet0/1
1.1.1.1           0   FULL/  -        00:00:38    10.0.12.1       GigabitEthernet0/0
FULL/ -: fully adjacent, and the dash means no DR or BDR role on a point-to-point link. Neighbor ID names the remote OSPF process; Address is the remote link IP. Interface is R2's local interface. The falling Dead Time is refreshed by valid Hellos. R1 and R3 each have only one transit neighbour.

Then, on R3, inspect the OSPF-learned remote networks and default. R3's own connected LAN and transit network are not O entries and will not appear in this filtered command.

Example output written for this lab, based on Cisco IOS documentation
R3#show ip route ospf
Gateway of last resort is 10.0.23.1 to network 0.0.0.0

O*E2  0.0.0.0/0 [110/1] via 10.0.23.1, 00:02:41, GigabitEthernet0/0
O        10.0.12.0/30 [110/20] via 10.0.23.1, 00:02:51, GigabitEthernet0/0
O     192.168.1.0/24 [110/30] via 10.0.23.1, 00:02:51, GigabitEthernet0/0
O     192.168.2.0/24 [110/20] via 10.0.23.1, 00:02:51, GigabitEthernet0/0
Cost 30 to LAN 1 is three outgoing gigabit interfaces at 10 each: R3 Gi0/0, R2 Gi0/0 and R1 Gi0/0. In [110/30], 110 is Cisco's administrative distance and 30 is the OSPF metric. The next hop is R2's link address, not R1's router ID. O*E2 identifies the external type-2 candidate default.
Puzzle: why is the default route's cost 1, not 21?

It is an E2 (external type 2) route. Its metric is the value R1 set when it advertised it (1 by default) and doesn't grow as it crosses the network. An E1 route would add the internal cost along the way.

Task 4: test from end to end

On PC-1, ping its gateway first, then 192.168.3.10. Check the return direction from the server as well. If the routers have routes but the host test fails, check the host gateway, LAN connection and ICMP permissions before changing OSPF. The following trace is a Windows-style command; other lab tools may use traceroute.

End to end test
End to end testPing across the network, then trace.PingPC to serverTracerouteshows each hopComparewith the expected path

On small screens, swipe sideways or focus the diagram and use the arrow keys.

The path should match the lowest cost.
Example output from PC1 (192.168.1.10), written for this lab
C:\> tracert -d 192.168.3.10
Tracing route to 192.168.3.10 over a maximum of 30 hops

  1    1 ms    1 ms    1 ms  192.168.1.1
  2    1 ms    1 ms    1 ms  10.0.12.2
  3    2 ms    1 ms    1 ms  10.0.23.2
  4    2 ms    2 ms    2 ms  192.168.3.10

Trace complete.
This illustrative trace contains R1, R2, R3 and the final host. Actual reply source addresses can vary with the platform and return routing. Asterisks mean a probe received no response, not automatic proof that the corresponding router cannot forward traffic.

Task 5: three faults that stop a neighbourship

These are three useful lab faults. Pick each one and watch what happens on the R2–R3 link, then say which command shows it and how you would fix it.

Common neighbour blockers
Common neighbour blockersFaults that stop a neighbourship are usually mismatches.Neighbour not formingTimershello or dead differsArea or subnetarea ID or subnet differsPassive or filterinterface passive or ACL

On small screens, swipe sideways or focus the diagram and use the arrow keys.

Compare the interface settings on both ends.

The diagram choices simulate the symptoms; they do not alter a router. If you reproduce a fault on your own lab, start from the healthy saved state, change only the named interface and restore it before testing another fault. Otherwise several simultaneous faults can hide one another.

Fault on the R2–R3 link:
Gi0/2Gi0/1 .1.2 Gi0/010.0.12.0/30Gi0/1 .1.2 Gi0/010.0.23.0/30Gi0/0Gi0/2Gi0/1ISPIP 203.0.113.1R1RID 1.1.1.1R2RID 2.2.2.2R3RID 3.3.3.3LAN 1Subnet 192.168.1.0/24LAN 2Subnet 192.168.2.0/24LAN 3Subnet 192.168.3.0/24

Device key: ISP (network / service) · R1, R2, R3 (router) · LAN 1, LAN 2, LAN 3 (network / site)

Lines show the example’s network connections. Thick links: uplinks/WAN, as labelled. The coloured path and envelope follow the current step; its text identifies the sender, receiver and traffic type.

Reading the addresses

IP labels identify interfaces or destinations. Subnet labels identify networks; /n is the prefix length. A router ID (RID) identifies a routing process and need not be a reachable interface.

An IP address alone is not a URL. A web URL includes a scheme such as https://; an address on a router or printer does not imply a website.

  • ISP: IP 203.0.113.1
  • R1: RID 1.1.1.1
  • R2: RID 2.2.2.2
  • R3: RID 3.3.3.3
  • LAN 1: Subnet 192.168.1.0/24
  • LAN 2: Subnet 192.168.2.0/24
  • LAN 3: Subnet 192.168.3.0/24
  1. 1. Hellos both ways: each hello lists the neighbours the sender has heard, so both reach 2-Way.
  2. 2. Databases synchronised: they exchange database descriptions and any missing LSAs, then reach Full.
  3. 3. Routes installed: R3 learns 192.168.1.0/24 at cost 30 and can reach LAN 1.
The same addressed topology under three independent faults. Hello acceptance comes before database exchange and Full adjacency.
Which command would you run first for each fault?
  • Area mismatch: show ip ospf interface brief on both routers: compare the Area column.
  • Passive link: show ip protocols: the interface is under Passive Interface(s).
  • MTU mismatch: EXSTART or EXCHANGE directs you to database negotiation. Compare the IP MTU using show ip interface on both ends and inspect the interface configuration. MTU is one possible cause, not a diagnosis from the state alone.

The MTU fault is the one that tends to eat time in real networks: the neighbour does appear, the hellos look healthy, and the problem only shows in the state column.

Optional: reproduce one fault on your isolated lab

These are three separate exercises. Do not paste all three fault blocks into one configuration. After each experiment, restore the healthy state and confirm the same two Full neighbours on R2 before continuing.

interface GigabitEthernet0/0 ip ospf 1 area 1

Area fault on R3, starting in global configuration mode. Compare the interface's area with R2 Gi0/1. Restore the effective area using ip ospf 1 area 0 on R3 Gi0/0.

router ospf 1 passive-interface GigabitEthernet0/1

Passive fault on R2. The transit link remains physically up, but Hellos stop. Restore with no passive-interface GigabitEthernet0/1 under this OSPF process.

interface GigabitEthernet0/0 ip mtu 1400

MTU fault on R3. First confirm the healthy IP MTU is 1500 on both endpoints. After comparing negotiation states and IP MTUs, restore this lab's original default using no ip mtu and verify the actual value.

Bonus: a cost change that only works one way

On R2, you set ip ospf cost 100 on Gi0/1 (towards R3). Which router's routes change: R1's route to LAN 3, R3's route to LAN 1, or both?

Show answer

Of the two routes asked about, only R1's route to LAN 3 changes. R2's own route to LAN 3 changes too. Cost counts on the way out of an interface, and R2 Gi0/1 is outgoing only for traffic towards R3. R1's cost to 192.168.3.0/24 becomes 10 + 100 + 10 = 120. R3's cost to LAN 1 stays 30, because that traffic leaves R2 through Gi0/0.

Try the cost change only after the baseline works. Compare show ip route 192.168.3.10 on R1 and show ip route 192.168.1.10 on R3. Restore the calculated baseline with no ip ospf cost on R2 Gi0/1. This line topology has no alternate path, so changing a metric cannot create failover around a broken link.

Finish with evidence, not just saved commands

Record the neighbour counts, the cost-30 route from R3 to LAN 1 and the successful two-way host test. Only then save your lab with copy running-config startup-config. Keep deliberate fault snapshots separate from the healthy configuration.

Technical references: OSPFv2, RFC 2328, Cisco database-exchange troubleshooting and Cisco OSPF configuration questions. Output here is written for teaching; no running-device execution is claimed.