feature ospf
Enable the OSPF routing protocol process on the switch.
Overview
The 'feature ospf' command is the first step in enabling OSPF (Open Shortest Path First) routing on Cisco Nexus switches running NX-OS. OSPF is a link-state routing protocol that uses the Dijkstra algorithm to compute the shortest path tree. It is widely used in enterprise and data center networks for its fast convergence, scalability, and support for hierarchical design through areas. On NX-OS, features must be explicitly enabled before their configuration commands become available. This is a departure from Cisco IOS, where OSPF is implicitly available once you enter 'router ospf'. The 'feature ospf' command loads the OSPF process and makes all OSPF-related commands accessible. It is typically issued in global configuration mode. After enabling the feature, you can create an OSPF instance using 'router ospf <process-id>' and configure interfaces with 'ip router ospf <process-id> area <area-id>'. The command is non-disruptive and can be issued on a live network, but it will start the OSPF process immediately, potentially forming adjacencies if interfaces are already configured. In troubleshooting workflows, verifying that OSPF is enabled is a first step when OSPF is not working. Use 'show feature' to confirm. On Nexus platforms, OSPF supports features like graceful restart, BFD, and route redistribution. The command is also used in automation scripts to ensure OSPF is enabled before applying further configuration.
feature ospfWhen to Use This Command
- Enable OSPF on a Nexus switch to participate in dynamic routing within an OSPF domain.
- Prepare the switch for OSPF configuration before creating OSPF instances and assigning interfaces.
- Enable OSPF as part of a migration from static routing to dynamic routing.
- Enable OSPF to support multi-area OSPF designs for scalability.
Parameters
| Parameter | Syntax | Description |
|---|---|---|
| No parameters | feature ospf | The command has no parameters. It simply enables the OSPF feature globally. To disable, use 'no feature ospf'. |
Command Examples
Enable OSPF Feature
configure terminal
feature ospfswitch(config)# feature ospf switch(config)#
The command enables the OSPF feature globally. No output indicates success; the prompt returns to config mode.
Verify OSPF Feature Status
show feature | include ospfospf 1 enabled
The output shows that OSPF instance 1 is enabled. The first column is the feature name, second is instance number, third is status.
Understanding the Output
The 'feature ospf' command itself produces no output on success. To verify, use 'show feature | include ospf'. The output shows the OSPF feature status: 'enabled' means the feature is active. If disabled, it shows 'disabled'. The instance number is typically 1 for the default OSPF process. A healthy state is 'enabled'. If OSPF is not enabled, routing will not work. The command is a prerequisite for all OSPF configuration.
Configuration Scenarios
Basic OSPF Configuration
Enable OSPF and configure a single area on a Nexus switch.
Topology
Nexus-1 --- Ethernet1/1 --- Nexus-2Steps
- 1.Enter global configuration mode.
- 2.Enable OSPF feature.
- 3.Create OSPF process 1.
- 4.Assign interface Ethernet1/1 to OSPF area 0.
configure terminal feature ospf router ospf 1 router-id 1.1.1.1 interface ethernet1/1 ip router ospf 1 area 0
Verify: Use 'show ip ospf neighbor' to see neighbors, 'show ip ospf interface' to verify interface status.
Watch out: If OSPF is not enabled first, 'router ospf 1' will be rejected.
Troubleshooting with This Command
When troubleshooting OSPF on NX-OS, the first step is to verify that the OSPF feature is enabled. Use 'show feature | include ospf'. If it shows 'disabled', issue 'feature ospf' in global config. If the command fails, check if the switch supports OSPF (some Nexus models may have licensing restrictions). After enabling, verify the OSPF process is running with 'show ip ospf'. Common issues include OSPF not forming adjacencies because the feature was enabled after interface configuration; ensure interfaces are configured with 'ip router ospf' after the feature is enabled. Also, check that OSPF is not disabled due to a configuration replace or rollback. If OSPF stops working unexpectedly, re-issue 'feature ospf' and verify. Use 'show running-config | section ospf' to see OSPF configuration. On NX-OS, the 'feature ospf' command is idempotent; issuing it multiple times has no negative effect. For advanced troubleshooting, use 'debug ip ospf events' but ensure the feature is enabled first.
CCNA Exam Tips
Remember that 'feature ospf' is required before any OSPF configuration on NX-OS; unlike IOS where 'router ospf' automatically enables it.
On NX-OS, OSPFv2 and OSPFv3 are separate features: 'feature ospf' for IPv4, 'feature ospfv3' for IPv6.
Use 'no feature ospf' to disable OSPF entirely, which removes all OSPF configuration.
Common Mistakes
Forgetting to issue 'feature ospf' before configuring OSPF, resulting in 'invalid command' errors.
Assuming OSPF is enabled by default; it is not on NX-OS.
Disabling OSPF with 'no feature ospf' without realizing it removes all OSPF configuration.
Platform Notes
On Cisco NX-OS, features are disabled by default and must be explicitly enabled. This is different from Cisco IOS where OSPF is available without a separate command. On IOS, you can directly enter 'router ospf 1'. On NX-OS, 'feature ospf' is mandatory. Also, on NX-OS, OSPFv2 and OSPFv3 are separate features; 'feature ospf' is for IPv4, while 'feature ospfv3' is for IPv6. On IOS, OSPFv3 is enabled under 'ipv6 router ospf'. On NX-OS, the 'feature ospf' command does not take any parameters; the process ID is defined later. In earlier NX-OS versions, some features required a 'feature' command with instance number, but OSPF does not. The command is available on all Nexus platforms (7000, 9000, 3000, etc.) but may require appropriate license. On Nexus 9000 in ACI mode, OSPF is not used; this applies to NX-OS standalone mode.
Practice for the CCNA 200-301
Test your knowledge with hundreds of CCNA practice questions covering all exam domains.
Practice CCNA Questions