Introduction
OSPF on Cisco IOS is the most common IGP (Interior Gateway Protocol) in enterprise networks. Unlike the MikroTik OSPF guide, Cisco's OSPF configuration uses a different syntax and has unique enterprise features like route redistribution, virtual links, and stub areas.
OSPF Fundamentals
OSPF is a link-state protocol — every router knows the complete topology (LSDB). Routers calculate shortest paths using Dijkstra's algorithm.
Key Terms:- Router ID: Unique identifier for each OSPF router (highest loopback IP by default)
- Area: Group of routers sharing the same LSDB
- ABR: Area Border Router — connects multiple areas
- ASBR: Autonomous System Boundary Router — redistributes external routes into OSPF
- LSA: Link State Advertisement — the unit of OSPF topology information
Basic OSPF Configuration
CISCO
! Enable OSPF process (number is local only, doesn't need to match peers)
router ospf 1
! Set Router ID explicitly (best practice)
router-id 10.0.0.1
! Advertise networks in OSPF
network 10.0.0.0 0.0.0.255 area 0 ! All /24 in 10.0.0.x → backbone area
network 192.168.1.0 0.0.0.255 area 1 ! Branch network → area 1
network 10.10.10.10 0.0.0.0 area 0 ! Loopback → backbone
! Or configure OSPF per-interface (modern recommended approach)
interface GigabitEthernet0/0
ip ospf 1 area 0
ip ospf cost 10
ip ospf hello-interval 5
ip ospf dead-interval 20OSPF Authentication (MD5)
Always enable authentication to prevent rogue router injection:
CISCO
! Interface-level MD5 auth
interface GigabitEthernet0/0
ip ospf authentication message-digest
ip ospf message-digest-key 1 md5 YourSecretKey
! Area-level auth (applies to all interfaces in area)
router ospf 1
area 0 authentication message-digestArea Types and Design
CISCO
! Regular area (full LSA flooding)
router ospf 1
area 1 range 192.168.1.0 255.255.255.0 ! Summarize area 1 at ABR
! Stub area (no external LSAs from ASBR)
router ospf 1
area 2 stub
! All routers in area 2 must also have: area 2 stub
! Totally Stubby area (no external, no summary LSAs — only default route)
router ospf 1
area 2 stub no-summary ! Only on ABR
! Regular routers in area: area 2 stub
! NSSA (Not-So-Stubby Area) — allows ASBR inside stub area
router ospf 1
area 3 nssaRoute Redistribution
Import routes from other protocols into OSPF:
CISCO
! Redistribute connected networks
router ospf 1
redistribute connected subnets metric 10 metric-type 1
! Redistribute static routes
router ospf 1
redistribute static subnets
! Redistribute from BGP
router ospf 1
redistribute bgp 65001 subnets metric 10
! Redistribute from EIGRP with filtering
router ospf 1
redistribute eigrp 10 subnets route-map EIGRP-TO-OSPF
route-map EIGRP-TO-OSPF permit 10
match ip address prefix-list ALLOWED-PREFIXES
ip prefix-list ALLOWED-PREFIXES permit 10.0.0.0/8 le 24BFD for Sub-Second Failure Detection
CISCO
! BFD replaces OSPF dead-interval for faster failure detection
interface GigabitEthernet0/0
bfd interval 300 min_rx 300 multiplier 3 ! Detect failure in 900ms
router ospf 1
bfd all-interfaces ! Enable BFD for all OSPF interfacesVerifying OSPF
CISCO
! View OSPF neighbors
show ip ospf neighbor
! Detailed neighbor info
show ip ospf neighbor detail
! View OSPF link-state database
show ip ospf database
! View specific LSA type
show ip ospf database router ! Type 1 LSAs
show ip ospf database network ! Type 2 LSAs
show ip ospf database summary ! Type 3 LSAs (inter-area)
show ip ospf database external ! Type 5 LSAs (external routes)
! View OSPF routes
show ip route ospf
! View OSPF interface info
show ip ospf interface brief
! Check process info
show ip ospfCommon OSPF Issues
CISCO
! Issue: Neighbors stuck in EXSTART/EXCHANGE
! Cause: MTU mismatch
interface GigabitEthernet0/0
ip ospf mtu-ignore
! Issue: Neighbors not forming (check timers)
! Hello/Dead must match between neighbors
show ip ospf interface GigabitEthernet0/0 | include intervals
! Issue: Route not appearing in table
! Check that network statement covers the interface
debug ip ospf events
debug ip ospf adj
! Issue: Flapping adjacency
! Look for BFD mismatches or unreliable links
show ip ospf statistics