Steer traffic with cost, and share the default route
OSPF runs on the triangle. The direct R1-R3 link is a slow backup line, so traffic between R1 and R3 must go through R2 while R2 is there:
- Give the R1-R3 link (R1 Gi0/2 and R3 Gi0/0) OSPF cost 100 on both ends.
- R1 has a static default route to the ISP. Advertise it into OSPF so R2 and R3 can reach the internet (8.8.8.8).
How it works: this is VulnTech NetLab, a network simulator running in your browser. Click a device in the diagram to open its console and type commands, just like on real equipment (? shows help, Tab finishes a word). Click a cable to inspect it. Tasks tick themselves off as you complete them; questions are answered in the box under each task. Your work is kept if you reload; Reset starts the network over.
Solution explanation
The cost of a path is the sum of the outgoing interfaces' costs. R1 to 192.168.3.0/24 directly is now 100 + 1 = 101; through R2 it's 1 (R1 Gi0/1) + 1 (R2 Gi0/1) + 1 (R3 Gi0/2) = 3, so that path wins. Set the cost on both ends: each router only uses its own outgoing cost, so R3 would otherwise still send straight to R1. default-information originate works because R1 has a default route of its own; R2 and R3 learn it as O*E2.
Show solution
[R1]
enable
configure terminal
interface g0/2
ip ospf cost 100
exit
router ospf 1
default-information originate
end
[R3]
enable
configure terminal
interface g0/0
ip ospf cost 100
end
[R1]
show ip route 192.168.3.10
[R3]
show ip route ospf | begin Gateway
[PC3]
ping 8.8.8.8