OSPF for the CCNA: single-area OSPFv2
The CCNA covers single-area OSPFv2: neighbor adjacencies, the DR/BDR election, router IDs and basic configuration. Routing makes up the largest share of the exam (IP Connectivity, 25%).
What OSPF is
Open Shortest Path First is a link-state interior routing protocol. Routers exchange link-state advertisements, build the same map of the area, and run the shortest path first algorithm to choose routes. Its administrative distance is 110.
Neighbor states
Two routers move through these states before they exchange routes: Down, Init, 2-Way, ExStart, Exchange, Loading, Full. On broadcast networks, routers that are neither DR nor BDR stay in 2-Way with each other and go Full only with the DR and BDR.
Timers and addresses
- Hello interval 10 seconds and dead interval 40 seconds on broadcast and point-to-point networks.
- OSPF packets use multicast 224.0.0.5 (all OSPF routers) and 224.0.0.6 (DR and BDR).
Router ID and the DR/BDR election
The router ID is chosen in this order: a manually configured router-id, then the highest loopback IP, then the highest active physical interface IP. On a broadcast segment the DR is the router with the highest interface priority (default 1), and ties are broken by the highest router ID. A priority of 0 means the router never becomes DR or BDR. The election is not pre-emptive.
Cost
OSPF cost on Cisco devices is the reference bandwidth divided by the interface bandwidth. The default reference bandwidth is 100 Mbps, so FastEthernet is 1 and Gigabit Ethernet also rounds to 1. Change it with auto-cost reference-bandwidth (the same value on every router).
Basic configuration
router ospf 1 router-id 1.1.1.1 network 192.168.1.0 0.0.0.255 area 0 network 10.0.0.0 0.0.0.3 area 0 passive-interface g0/1
The network command uses a wildcard mask and enables OSPF on any interface whose address falls inside that range. passive-interface stops hellos on LAN-facing ports while still advertising the network. You can also enable OSPF per interface with ip ospf 1 area 0.
Verification commands
show ip ospf neighbor show ip ospf interface brief show ip route ospf show ip protocols
Why neighbors do not form
- Mismatched hello or dead timers.
- Different area IDs on the link.
- Different subnets or masks on the two interfaces.
- Mismatched authentication settings.
- The interface is passive or shut down.
- Duplicate router IDs.
Copy-ready snippets are in the IOS cheat sheet. Practise in Cisco Packet Tracer with three routers, then check yourself with the quiz.
Frequently asked questions
What is the default OSPF administrative distance?
110.
How is the OSPF router ID chosen?
A configured router-id wins, then the highest loopback IP address, then the highest active interface IP address.
What is the default OSPF hello timer?
10 seconds on broadcast and point-to-point networks, with a 40 second dead timer.
Facts about the exam come from Cisco's CCNA page; always confirm there before booking.