PermitANY
Cisco IOS XRConfig1 downloads

Cisco IOS XR OSPF Configuration

OSPF configuration for Cisco IOS XR routers. Interface-based (no network command), supports BFD, multi-area, redistribution, and point-to-point links for SP environments.

↓ example.txt

What is it?

OSPF on IOS XR uses the same RFC 2328 protocol as IOS/IOS-XE, but the configuration model is completely different. IOS XR uses interface-based OSPF configuration — there is no 'network' command. Instead, you enable OSPF directly under each interface within the OSPF process hierarchy: 'router ospf 1 > area 0 > interface GigE0/0/0/0'. This approach makes the configuration more explicit and easier to audit. In service provider environments, OSPF runs as the IGP underlay, providing loopback reachability for iBGP, MPLS LDP, and Segment Routing. BFD is always recommended on IOS XR OSPF links for sub-second failure detection.

When to use

  • ·As the IGP underlay in MPLS service provider networks (loopback reachability for LDP/SR)
  • ·PE-to-P router routing in MPLS core networks
  • ·Any IOS XR network requiring dynamic routing with fast convergence
  • ·When BFD is required for sub-second link failure detection on P2P links
  • ·Multi-area designs with hierarchical routing in large SP networks

When NOT to use

  • ·Connecting to external autonomous systems — use BGP for inter-AS routing
  • ·Very simple networks with 2-3 routers — static routes are sufficient and simpler
  • ·When IS-IS is already deployed as IGP — mixing OSPF and IS-IS in the same network adds complexity

How it compares

vs Cisco IOS OSPFIOS OSPF uses 'network x.x.x.x wildcard area X' statements. IOS XR configures OSPF per-interface under the OSPF process. Both implement RFC 2328 — neighbors will form correctly between IOS and IOS XR.
vs IS-IS on IOS XRIS-IS is the alternative IGP for IOS XR SP networks. IS-IS has no DR/BDR concept, converges slightly faster at scale, and is preferred by some carriers. OSPF is more familiar to enterprise engineers. Both work well.
vs Static RoutesStatic routes are manual and don't adapt to failures. OSPF recalculates paths automatically when a link fails, providing resilience. In SP cores with redundant paths, OSPF (or IS-IS) is mandatory.

Prerequisites

  • →Interfaces must have 'ipv4 address' configured and be in 'no shutdown' state before adding to OSPF
  • →Loopback0 with a /32 address should be configured as the router-id source
  • →BFD requires the interface hardware to support it — verify with 'show bfd session'
  • →If redistributing BGP, the route-policy PASS-ALL must be defined before the redistribute statement

Config Generator

Set to 100000 for 100G environments

Verification commands

show ospf neighbor

Show all OSPF neighbors and adjacency state

ExpectedAll neighbors should be FULL. 2WAY only on broadcast segments for non-DR/BDR.

show ospf interface brief

List all OSPF-enabled interfaces with area and network type

ExpectedCorrect area assignment, P2P type for core links, cost reflects bandwidth

show route ospf

Show OSPF routes in the routing table

ExpectedAll loopbacks and connected prefixes from OSPF neighbors visible, marked 'O'

show ospf database

View the LSDB to verify all Router LSAs are present

ExpectedRouter LSAs from all routers in the area, no missing entries

Debug commands

debug ospf events

Live OSPF event debugging for adjacency issues

WarningUse only in non-production or during a maintenance window. Run 'undebug all' to stop.

show bfd session

Verify BFD sessions are Up for all OSPF neighbors with BFD enabled

WarningBFD Down will cause OSPF adjacency to drop immediately. Verify BFD timers match.

Common mistakes & fixes

SymptomOSPF neighbor not forming — stuck in INIT
CauseACL or firewall blocking OSPF multicast 224.0.0.5 or unicast (protocol 89)
FixCheck 'show access-lists' for applied ACLs. Permit protocol 89 or 224.0.0.5/224.0.0.6 on the interface.
SymptomOSPF neighbor EXSTART/EXCHANGE and not reaching FULL
CauseMTU mismatch on connected interfaces
FixMatch MTU: 'ipv4 mtu 9000' on both sides, or add 'mtu-ignore enable' under the OSPF interface.
SymptomInterface not appearing in OSPF despite configuration
CauseInterface in wrong state (admin down) or OSPF config not committed
FixVerify 'no shutdown' on interface. Run 'commit' if changes are pending. Check 'show configuration failed'.

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