PermitANY

Cisco NX-OS OSPF Configuration

Cisco NX-OSIntermediate

OSPF underlay or overlay routing for Cisco Nexus switches. Supports named OSPF instances, point-to-point links, BFD, and multi-area configuration.

↓ example.txt

What is it?

NX-OS OSPF is the same OSPF protocol (RFC 2328) as Cisco IOS, but with a different CLI structure. NX-OS uses named OSPF instances ('router ospf UNDERLAY') instead of numeric process IDs, and OSPF is configured per-interface under the interface context rather than via network statements. In data center deployments, OSPF is almost always the underlay for VXLAN EVPN — it provides reachability between loopbacks (VTEPs) and handles fast failover with BFD. All links in the fabric use point-to-point network type to avoid DR/BDR election overhead.

✓ When to use

  • ·As the IP underlay for VXLAN EVPN fabric — OSPF redistributes loopback reachability to all VTEPs
  • ·Data center spine/leaf topologies where fast convergence is critical
  • ·Any NX-OS network requiring dynamic routing between Nexus switches
  • ·When BFD (Bidirectional Forwarding Detection) is needed for sub-second failure detection

✗ When NOT to use

  • ·For external BGP peering or internet routing — use BGP
  • ·On routed interfaces connecting to non-Cisco devices that don't support named OSPF instances (they just use the process ID internally, so it's compatible, but the CLI differs)

How it compares

vs Cisco IOS OSPFSame protocol, different CLI. NX-OS uses named instances and per-interface config. IOS uses process IDs and 'network' statements. NX-OS OSPF also integrates with BFD more easily.
vs IS-IS on NX-OSIS-IS is the alternative underlay for VXLAN EVPN on NX-OS. IS-IS converges slightly faster than OSPF and has no DR/BDR concept. Cisco recommends IS-IS for very large fabrics (200+ switches).
vs BGP as underlaySome designs use eBGP as both underlay and overlay. This simplifies the design but makes BGP config more complex. OSPF/IS-IS + eBGP EVPN overlay is more common and easier to troubleshoot.

Prerequisites

  • 'feature ospf' must be enabled before any OSPF configuration
  • Loopback interfaces must be created and assigned IPs before adding them to OSPF
  • BFD requires 'feature bfd' to be enabled and the interface to support it
  • For VXLAN EVPN underlay: all loopback0 (router-id) and loopback1 (VTEP source) addresses must be reachable via OSPF

Config Generator

Verification commands

show ip ospf neighbors

Show all OSPF neighbors and their state

Expected: All connected neighbors should be in FULL state. 2WAY is normal only for non-DR/BDR on broadcast networks.

show ip ospf interface brief

Show OSPF-enabled interfaces and their network type, cost, and hello interval

Expected: Fabric interfaces should show 'P2P' network type. Verify correct area assignment.

show ip route ospf

Verify OSPF routes are in the routing table

Expected: Should include all loopback addresses from other switches in the fabric

Debug commands

show ip ospf database

Show the LSDB — verify all routers have the correct link-state information

Common mistakes & fixes

OSPF neighbor stuck in EXSTART

Cause: MTU mismatch between connected interfaces

Fix: Match MTU on both interfaces, or add 'ip ospf mtu-ignore' to the interface on NX-OS.

Loopback routes not appearing on remote switches

Cause: Loopback interface not added to OSPF, or 'passive-interface' set incorrectly

Fix: Verify 'ip router ospf UNDERLAY area 0' is on the loopback interface. Check 'show ip ospf interface loopback0'.

OSPF adjacency flapping

Cause: BFD timeout due to packet loss, or hello/dead timer mismatch

Fix: Check interface errors: 'show interface <if>'. Verify hello/dead timers match. Lower BFD timers if necessary.

Related configs