Cisco NX-OS OSPF Configuration
OSPF underlay or overlay routing for Cisco Nexus switches. Supports named OSPF instances, point-to-point links, BFD, and multi-area configuration.
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
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
NX-OS requires the source AS on the redistribute line — `redistribute bgp 65001 route-map ...`. Only needed when Redistribute BGP is Yes, and the route-map RM-BGP-TO-OSPF must already exist or NX-OS redistributes nothing.
Verification commands
show ip ospf neighborsShow all OSPF neighbors and their state
ExpectedAll connected neighbors should be in FULL state. 2WAY is normal only for non-DR/BDR on broadcast networks.
show ip ospf interface briefShow OSPF-enabled interfaces and their network type, cost, and hello interval
ExpectedFabric interfaces should show 'P2P' network type. Verify correct area assignment.
show ip route ospfVerify OSPF routes are in the routing table
ExpectedShould include all loopback addresses from other switches in the fabric
Debug commands
show ip ospf databaseShow the LSDB — verify all routers have the correct link-state information
Common mistakes & fixes
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