Configuration Guide

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 terminal
router ospf 1
Starts OSPF process 1 (the number is locally significant)

Step 2: Set a stable router ID

router-id 1.1.1.1Manually fixes the router ID for stability

Step 3: Advertise networks with wildcard masks

network 192.168.1.0 0.0.0.255 area 0
network 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.

VS
Vipul Sir — Lead Instructor, Attila Technologies20+ years in Cisco networking. Teaching CCNA, CCNP, CCIE & CyberOps in Ahmedabad since 2004.

Want hands-on training?

Learn this on real Cisco lab devices with placement support at Attila Technologies, Ahmedabad.

Start your networking career with Attila Technologies

Hands-on Cisco training, real lab devices and placement support in Ahmedabad.