Cisco CCNA Preparation · lesson 21 of 36 · 25 min
OSPF Basics
OSPF (Open Shortest Path First) is a link-state routing protocol that uses Dijkstra’s SPF algorithm to calculate the shortest path to every network. It is the most widely deployed IGP in enterprise networks and is heavily tested on the CCNA exam.
Key characteristics: classless (supports VLSM/CIDR), fast convergence, uses cost as metric, organises routers into areas (Area 0 = backbone), sends LSAs (Link State Advertisements) to build a topology database (LSDB).
OSPF Configuration — network Statement Method
The network statement under router ospf tells OSPF which interfaces to activate on. The wildcard mask works like an inverted subnet mask — 0 bits must match, 255 bits are ignored.
Configure OSPF on a router with two LAN interfaces and one WAN link
Enter OSPF process router ospf 1 — process ID 1 is locally significant. Set router ID manually router-id 1.1.1.1 — prevents ID changes if interfaces go down. Advertise LAN 192.168.1.0/24 network 192.168.1.0 0.0.0.255 area 0 — wildcard 0.0.0.255 matches the /24.
- Advertise LAN 192.168.2.0/24
- network 192.168.2.0 0.0.0.255 area 0
- Advertise WAN link 10.0.0.0/30
network 10.0.0.0 0.0.0.3 area 0 — wildcard 0.0.0.3 matches the /30. Make LAN interfaces passive passive-interface Gi0/0 — advertises the network but stops sending Hellos to end devices. Verify show ip ospf neighbor — should show FULL state with the WAN neighbour.
Router 1 — complete OSPF config
Passive Interfaces
A passive interface is advertised in OSPF (the network appears in the routing table) but does not send or receive OSPF Hello packets. Use it on interfaces connected to end devices (not other routers) to prevent unnecessary OSPF traffic and improve security.
Default Route Propagation
To advertise a default route to all OSPF neighbours, use default-information originate. This is typically configured on the router connected to the internet (the ASBR — Autonomous System Boundary Router).
Verify
On neighbours, the default route appears as O*E2 0.0.0.0/0 in the routing table. O*E2 = OSPF external type 2 default route.
OSPF Neighbour States
FULL is the goal
Neighbours must reach the FULL state for OSPF to work. On broadcast networks, only DR and BDR neighbours reach FULL — other routers stay at 2-Way with each other (normal behaviour).
Knowledge Check — 10 Questions
OSPF Configuration
What does the OSPF process ID represent?
- The OSPF area number
- A locally significant identifier — does not need to match neighbours
- The router ID
- The AS number
Answer: A locally significant identifier — does not need to match neighbours
The OSPF process ID (e.g. router ospf 1) is locally significant. Neighbours can have different process IDs and still form adjacencies.
What is the wildcard mask for a /24 network in an OSPF network statement?
- 255.255.255.0
- 0.0.0.255
- 0.0.255.255
- 255.255.0.0
Answer: 0.0.0.255
Wildcard masks are the inverse of subnet masks. /24 = 255.255.255.0 subnet mask → 0.0.0.255 wildcard. 0 bits must match; 255 bits are ignored.
What is the purpose of a passive interface in OSPF?
- Prevents the network from being advertised
- Advertises the network but suppresses OSPF Hello packets on that interface
- Increases the OSPF cost on that interface
- Enables OSPF authentication
Answer: Advertises the network but suppresses OSPF Hello packets on that interface
Passive interfaces advertise the connected network in OSPF but do not send or receive Hellos. Use on LAN interfaces connected to end devices.
What command advertises a default route to all OSPF neighbours (only if a default route exists locally)?
- ip route 0.0.0.0 0.0.0.0
- default-information originate
- redistribute static
- network 0.0.0.0 255.255.255.255 area 0
Answer: default-information originate
default-information originate under router ospf advertises a Type 5 LSA for the default route to all OSPF neighbours. Add always to advertise even without a local default route.
What OSPF neighbour state indicates a fully synchronised adjacency?
- 2-Way
- Exchange
- Loading
- Full
Answer: Full
FULL state means the LSDB is synchronised between neighbours. Routes are only installed after reaching FULL. On broadcast networks, non-DR/BDR routers stay at 2-Way with each other.
How does OSPF select the router ID if it is not manually configured?
- Lowest IP address on any interface
- Highest IP address on a loopback interface; then highest active interface IP
- Random selection
- The process ID is used as the router ID
Answer: Highest IP address on a loopback interface; then highest active interface IP
OSPF router ID selection: 1) Manual (router-id command) — preferred. 2) Highest loopback IP. 3) Highest active physical interface IP.
What does O IA mean in the routing table?
- OSPF internal area route
- OSPF inter-area route (from a different OSPF area)
- OSPF external type 1
- OSPF intra-area route
Answer: OSPF inter-area route (from a different OSPF area)
O = OSPF intra-area (same area). O IA = OSPF inter-area (different area, passed through ABR). O E1/E2 = external routes redistributed into OSPF.
Which command verifies OSPF neighbour relationships and their states?
- show ip route ospf
- show ip ospf neighbor
- show ip ospf database
- show ip protocols
Answer: show ip ospf neighbor
show ip ospf neighbor shows all OSPF neighbours, their router IDs, states (should be FULL), dead timer, and interface. Essential for troubleshooting.
The OSPF backbone area that all other areas must connect to is Area _____.
Answer: 0
Area 0 is the OSPF backbone. All non-backbone areas must connect to Area 0 (directly or via a virtual link). ABRs connect non-backbone areas to Area 0.
What is the effect of passive-interface default followed by no passive-interface Gi0/0?
- All interfaces passive; Gi0/0 re-enabled for OSPF Hellos
- Gi0/0 becomes passive; all others active
- All interfaces disabled
- No effect
Answer: All interfaces passive; Gi0/0 re-enabled for OSPF Hellos
passive-interface default makes all interfaces passive. no passive-interface Gi0/0 re-enables Hellos on that specific interface. Useful when most interfaces face end devices.
Previous lesson: OSPFv2 single-area: neighbor adjacencies, DR/BDR, router ID, point-to-point vs broadcast
Back to Cisco CCNA Preparation
Next lesson: First Hop Redundancy: HSRP, VRRP, GLBP — active/standby, virtual IP, preemption