Routelearn.net
Course menu

Course 9: OSPFLesson 3.1 (5 of 6 in this course)74 of 104 in the CCNA series

Lab: single-area OSPF on three routers

Plan, configure and verify OSPF on the three-router network, then find and fix the three most common faults.

Intermediate · 25 min read

After this lesson, you can plan, configure and verify single-area OSPFv2 on three routers, and fix the three faults that most often stop a neighbourship.

Single-area OSPF is an OSPF design in which every router interface that runs OSPF belongs to the same area, normally area 0. Every router holds the same link-state database and calculates its own shortest paths from it.

In simple terms: All the routers share one map of the network, and each one works out its own best way to every LAN.

The situation

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. Every interface is addressed and up. R1 already has a static default route to the ISP (ip route 0.0.0.0 0.0.0.0 203.0.113.1); nothing else is configured. Use Cisco Packet Tracer, a lab emulator or paper.

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)

Task 1: plan it

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.

Show the plan
InterfaceOSPF?Passive?Why
LAN interfaces (R1 Gi0/0, R2 Gi0/2, R3 Gi0/1)YesYesThe LAN must be advertised, but no router lives there, so no hellos.
Router links (10.0.12.0/30, 10.0.23.0/30)YesNoNeighbours form here.
R1 Gi0/2 to the ISPNo–OSPF doesn't run towards the ISP. R1 advertises a default route instead.

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: no DR election, and the adjacency forms faster.

Task 2: configure the three routers

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.

Task 3: verify, bottom-up

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

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.

Then, on R3, every remote network and the default route:

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
      10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
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.
Check yourself: 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

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.
One line per router: R1's LAN address, then the address of the interface each next router received the packet on.

Task 5: break it and fix it

The faults below are the ones you meet most often. Pick each one and watch what happens on the R2–R3 link, then say which command shows it and how you would fix it.

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/1ISP203.0.113.1R1RID 1.1.1.1R2RID 2.2.2.2R3RID 3.3.3.3LAN 1192.168.1.0/24LAN 2192.168.2.0/24LAN 3192.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.
Hello problems stop routers before 2-Way; database problems stop them after it.
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: show ip ospf neighbor shows EXSTART or EXCHANGE; then compare show interfaces MTU on both ends.

Bonus: cost has a direction

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

Only R1's route to LAN 3. 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.