PermitANY
Cisco IOS / IOS-XEConfig1,926 downloads

Cisco IOS Multi-area OSPF

Multi-area OSPF configuration with route summarization, stub/NSSA areas, redistribution, and passive interfaces for Cisco IOS/IOS-XE routers.

↓ example.txt

What is it?

OSPF (Open Shortest Path First) is a link-state routing protocol that uses Dijkstra's algorithm to calculate the shortest path to each destination in the network. It's an open standard (RFC 2328), which means it works across routers from different vendors — Cisco, Juniper, Arista, Palo Alto, and others all speak OSPF. Each router builds a complete map of the network (the LSDB — Link State Database) and independently calculates its best paths. When a link fails, OSPF reconverges typically in under 5 seconds.

When to use

  • ·Medium to large enterprise networks with multiple routers (5+)
  • ·Multi-vendor environments where EIGRP is not an option
  • ·When you need fast convergence after a link failure (sub-5 seconds with BFD)
  • ·Internal routing within your organization (IGP) — between your own routers
  • ·Data center fabrics and campus networks with redundant paths
  • ·When you need to segment the network into areas to reduce LSA flooding

When NOT to use

  • ·Connecting to your ISP — use BGP instead (OSPF is for internal routing only)
  • ·Very small networks with 1–3 routers — static routes are simpler and sufficient
  • ·Cisco-only environments where EIGRP is already running — no reason to migrate
  • ·When you need routing policies between organizations — BGP is designed for that

How it compares

vs BGPBGP is for routing between organizations (internet/ISP). OSPF is for routing inside your own network. A typical enterprise runs both: OSPF internally + BGP toward the ISP.
vs EIGRPEIGRP is Cisco-proprietary and easier to tune. OSPF is open standard and required in multi-vendor environments. Both offer fast convergence; OSPF is preferred for new deployments.
vs Static RoutesStatic routes are manual and don't adapt to failures. OSPF discovers routes automatically and reroutes around failures within seconds. Use static for small/simple topologies.
vs IS-ISIS-IS is also a link-state protocol and very common in service provider networks. For enterprise, OSPF is more widely deployed and has better tooling and documentation.

Prerequisites

  • →All interfaces must have IP addresses configured before adding OSPF network statements
  • →Router IDs must be unique across all OSPF routers in the same domain
  • →Area 0 (backbone area) must exist — all other areas must connect to Area 0 directly or via a virtual link
  • →MTU must match on connected interfaces (mismatch causes EXSTART/EXCHANGE stuck state)
  • →Hello and Dead timers must match between neighbors (default: 10/40 on Ethernet, 30/120 on serial)
  • →Minimum IOS version: 12.0 for basic OSPF; IOS-XE 3.x for BFD integration

Config Generator

Recommended for spoke routers — suppresses Hello on all interfaces then re-enables per active link.

Verification commands

show ip ospf neighbor

Verify neighbor adjacency is FULL

ExpectedState should show FULL/DR, FULL/BDR, or FULL/ - (for point-to-point). Any other state means adjacency is not complete.

show ip ospf interface brief

Verify which interfaces are running OSPF and their state

ExpectedShows area assignment, cost, and neighbor count per interface. Passive interfaces show as Passive.

show ip route ospf

Verify OSPF routes are being installed in the routing table

ExpectedRoutes marked with O (intra-area) or O IA (inter-area). If empty, check adjacency and network statements.

show ip ospf database

View the LSDB — the complete network map OSPF has built

ExpectedShould show Router LSAs from all routers in the area. Missing entries indicate flooding or adjacency issues.

show ip ospf

Show OSPF process summary — Router ID, area count, SPF runs

ExpectedVerify Router ID is correct and matches what you configured. High SPF run count may indicate instability.

Debug commands

debug ip ospf adj

Debug adjacency formation — shows Hello exchange and state transitions

WarningUse with caution in production. Always run 'undebug all' immediately after. On a busy router this can generate heavy output.

debug ip ospf events

Shows all OSPF events including SPF triggers and LSA flooding

WarningVery verbose. Use only on a quiet router or in a maintenance window. Always 'undebug all' after.

Common mistakes & fixes

SymptomNeighbor stuck in EXSTART or EXCHANGE state
CauseMTU mismatch between the two routers on that link
FixMatch the MTU on both interfaces with 'ip mtu <value>'. As a workaround: 'ip ospf mtu-ignore' on both sides (not recommended long-term).
SymptomNeighbor stuck in INIT state
CauseOne-way communication — the remote router is not receiving Hellos. Common causes: ACL blocking multicast 224.0.0.5, wrong area, wrong subnet.
FixCheck ACLs on both routers (permit ip 224.0.0.5). Verify both interfaces are in the same subnet and same OSPF area.
SymptomNeighbor forms but routes are missing from routing table
CauseWrong wildcard mask in network statement, area mismatch, or route is being filtered by a distribute-list
FixVerify 'show ip ospf interface' shows the correct area. Check 'network' statements — wildcard must cover the interface IP. Check for distribute-list or prefix-list filters.
SymptomNeighbor adjacency keeps flapping (up/down repeatedly)
CauseHello or Dead timer mismatch, unstable link, or high CPU causing Hello drops
FixVerify timers match with 'show ip ospf interface'. Default Ethernet: hello 10, dead 40. For unstable links, consider BFD instead of tuning timers.
SymptomOSPF routes have higher metric than expected
CauseReference bandwidth not tuned — default is 100 Mbps, so GigE and 10GbE both show cost 1
FixSet 'auto-cost reference-bandwidth 10000' (for 10 Gbps) on ALL routers in the domain. Must be consistent across all routers.

Further learning

Recommended books to go deeper on this topic.

OSPF: Anatomy of an Internet Routing Protocol

John T. Moy · Addison-Wesley · The protocol from its author: LSA types, flooding, SPF and the design reasoning behind them

Routing TCP/IP, Volume 1

Jeff Doyle & Jennifer Carroll · Cisco Press · The definitive OSPF and IS-IS reference — essential for CCNP/CCIE

CCNP Enterprise Core ENCOR 350-401 Official Cert Guide

Brad Edgeworth et al. · Cisco Press · OSPF single-area, multi-area, LSA types, route summarization

Related configs