How to Configure OSPF on a Cisco Router
To configure OSPF: start the OSPF process, set a router ID, then advertise your networks with the correct wildcard masks and area. Here's the exact process with verification.
OSPF is the most common interior routing protocol. This enables it on a router and gets adjacencies forming. Practise in the OSPF lab.
Step 1: Enter OSPF configuration
configure terminalrouter ospf 1 | Starts OSPF process 1 (the number is locally significant) |
Step 2: Set a stable router ID
router-id 1.1.1.1 | Manually fixes the router ID for stability |
Step 3: Advertise networks with wildcard masks
network 192.168.1.0 0.0.0.255 area 0network 10.0.12.0 0.0.0.3 area 0 | Enables OSPF on matching interfaces in area 0 (note wildcard masks) |
Verification
show ip ospf neighbor should list neighbours in FULL state. show ip route ospf shows learned routes marked with O. If no neighbours appear, check matching area, timers, subnet and MTU.
Frequently asked questions
How do I enable OSPF on a Cisco router?
In global config: router ospf 1 starts the process; then use network statements with wildcard masks to advertise interfaces into an area.
What wildcard mask do I use in OSPF network statements?
The inverse of the subnet mask — 0.0.0.255 for a /24, 0.0.0.3 for a /30. It selects which interface addresses join OSPF.
How do I verify OSPF is working?
show ip ospf neighbor confirms adjacencies (look for FULL state); show ip route ospf shows the O-marked routes learned.
Why should I set the router ID manually?
For stability and clarity — otherwise OSPF picks the highest loopback or interface IP, which can change and complicate troubleshooting.
Related articles
Want hands-on training?
Learn this on real Cisco lab devices with placement support at Attila Technologies, Ahmedabad.