Static routes don’t scale. OSPF is the workhorse interior routing protocol — routers discover each other, share a map of the network, and compute the best paths automatically.
Why: OSPF is a link-state protocol — every router floods a description of its links, so all routers build the same map and each independently computes shortest paths (via Dijkstra) — which means it converges fast and scales far beyond static routes. When: use OSPF as the interior gateway protocol within an organization. Where: routers are grouped into areas (all connected to a backbone, area 0) to keep the map manageable.
Each router advertises its links -> everyone builds the SAME map (LSDB)
-> each runs Dijkstra -> best path to every network.
Cost metric = based on bandwidth (higher bandwidth = lower cost).
Areas keep large networks scalable; area 0 is the backbone all others join.Why: enabling OSPF is a matter of starting the process and telling it which interfaces to run on (via network statements and their areas) — the routers then find neighbors and exchange routes automatically. When: put the links you want OSPF to advertise into the right area. Where: the wildcard mask (inverse of the subnet mask) selects the interfaces.
R1(config)# router ospf 1 ! process ID (locally significant)
R1(config-router)# network 10.0.0.0 0.0.0.255 area 0
R1(config-router)# network 192.168.10.0 0.0.0.255 area 0
R1(config-router)# passive-interface Gig0/2 ! don't send hellos to end users
! On R2, put its links in area 0 too so they become neighbors.Why: OSPF only works once two routers become "neighbors" and reach the FULL state — so verifying adjacencies is the first troubleshooting step, followed by checking that routes appear. When: if a network is missing, check neighbors first (mismatched area, subnet, or timers are common causes). Where: OSPF routes show as O in the routing table.
R1# show ip ospf neighbor ! state must reach FULL
R1# show ip route ospf ! routes learned via OSPF (marked O)
R1# show ip ospf interface brief
! Common gotchas: interfaces in different areas, subnet/mask mismatch,
! or mismatched hello/dead timers -> the adjacency never forms.