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.
| Router | Interface | Address | Connects to |
|---|---|---|---|
| R1 | Gi0/0 | 192.168.1.1/24 | LAN 1 |
| Gi0/1 | 10.0.12.1/30 | R2 | |
| Gi0/2 | 203.0.113.2/30 | ISP (203.0.113.1) | |
| R2 | Gi0/0 | 10.0.12.2/30 | R1 |
| Gi0/1 | 10.0.23.1/30 | R3 | |
| Gi0/2 | 192.168.2.1/24 | LAN 2 | |
| R3 | Gi0/0 | 10.0.23.2/30 | R2 |
| Gi0/1 | 192.168.3.1/24 | LAN 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
| Interface | 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. |
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 originateR1. 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 0R2: 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 0R3, 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:
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:
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
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
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.
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.
- 1. Hellos both ways: each hello lists the neighbours the sender has heard, so both reach 2-Way.
- 2. Databases synchronised: they exchange database descriptions and any missing LSAs, then reach Full.
- 3. Routes installed: R3 learns 192.168.1.0/24 at cost 30 and can reach LAN 1.
Which command would you run first for each fault?
- Area mismatch:
show ip ospf interface briefon both routers: compare the Area column. - Passive link:
show ip protocols: the interface is under Passive Interface(s). - MTU mismatch:
show ip ospf neighborshows EXSTART or EXCHANGE; then compareshow interfacesMTU 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.