feature hsrp
Enables the Hot Standby Router Protocol (HSRP) feature on the switch, allowing configuration of HSRP groups for first-hop redundancy.
Overview
The 'feature hsrp' command is used to enable the Hot Standby Router Protocol (HSRP) on Cisco Nexus switches running NX-OS. HSRP is a First Hop Redundancy Protocol (FHRP) that provides high availability for the default gateway IP address. In a typical network, hosts are configured with a single default gateway; if that router fails, connectivity is lost. HSRP allows two or more routers to share a virtual IP address, with one acting as the active forwarder and the others as standby. If the active router fails, a standby takes over transparently. On NX-OS, features are disabled by default to conserve resources, so 'feature hsrp' must be issued before any HSRP configuration can be applied. This command is typically used in data center environments where Nexus switches serve as aggregation or access layer devices. Enabling HSRP is the first step in configuring redundancy for VLANs, often combined with interface-level commands like 'hsrp version', 'hsrp group', and 'ip address'. The command is straightforward but critical; without it, all HSRP-related commands will be rejected. In troubleshooting workflows, verifying that HSRP is enabled is a quick check when HSRP groups are not forming. The command does not require any parameters and is executed in global configuration mode. Once enabled, HSRP can be configured on Layer 3 interfaces (SVI, routed port, or port-channel). NX-OS supports HSRP version 1 and 2, with version 2 offering expanded group numbers and IPv6 support. The 'feature hsrp' command is also a prerequisite for other HSRP features like object tracking and authentication. It is important to note that disabling HSRP with 'no feature hsrp' removes all HSRP configuration, so it should be used with caution. Overall, this command is a simple but essential enabler for one of the most common redundancy protocols in Cisco networks.
feature hsrpWhen to Use This Command
- Enabling HSRP on a pair of Nexus switches to provide default gateway redundancy for a VLAN.
- Preparing to configure multiple HSRP groups for load balancing across different VLANs.
- Activating HSRP before configuring interface-level HSRP parameters in a data center leaf-spine topology.
- Enabling HSRP as part of a high-availability design for critical server subnets.
Parameters
| Parameter | Syntax | Description |
|---|---|---|
| No parameters | feature hsrp | This command has no additional parameters. It simply enables the HSRP feature globally on the Nexus switch. |
Command Examples
Enable HSRP Feature
configure terminal
feature hsrpswitch(config)# feature hsrp switch(config)#
Enters global configuration mode and enables the HSRP feature. No output confirms success.
Verify HSRP Feature Status
show feature | include hsrphsrp 1 enabled
Displays the status of the HSRP feature. 'enabled' indicates the feature is active.
Understanding the Output
The 'feature hsrp' command itself produces no output upon success; the prompt simply returns. To verify, use 'show feature | include hsrp'. The output shows the feature name and its state: 'enabled' means HSRP is active and ready for configuration. If the feature is disabled, the state will show 'disabled'. This command is a prerequisite for all HSRP configuration; without it, HSRP commands will be rejected. In NX-OS, features must be explicitly enabled before use, unlike IOS where some features are on by default.
Configuration Scenarios
Basic HSRP Configuration on an SVI
Two Nexus switches (Nexus-A and Nexus-B) provide redundant default gateway for VLAN 10. Hosts use virtual IP 10.10.10.1.
Topology
Hosts (VLAN 10)
|
Nexus-A ---- Nexus-B
(Active) (Standby)Steps
- 1.Enable HSRP feature on both switches.
- 2.Create VLAN 10 and SVI interface vlan10 on both switches.
- 3.Assign IP addresses: Nexus-A 10.10.10.2/24, Nexus-B 10.10.10.3/24.
- 4.Configure HSRP group 10 with virtual IP 10.10.10.1 on both switches.
- 5.Set priority on Nexus-A to 110 to make it active.
! On Nexus-A
configure terminal
feature hsrp
interface vlan10
ip address 10.10.10.2/24
hsrp version 2
hsrp 10
ip 10.10.10.1
priority 110
preempt
! On Nexus-B
configure terminal
feature hsrp
interface vlan10
ip address 10.10.10.3/24
hsrp version 2
hsrp 10
ip 10.10.10.1
preemptVerify: Use 'show hsrp group 10' to verify active/standby state and virtual IP.
Watch out: Ensure both switches have the same HSRP version; mismatch can cause group formation issues.
Troubleshooting with This Command
When troubleshooting HSRP on NX-OS, start by verifying that the HSRP feature is enabled with 'show feature | include hsrp'. If disabled, enable it with 'feature hsrp'. Next, check interface configuration: ensure the interface is Layer 3 (no switchport) or an SVI with an IP address. Use 'show hsrp brief' to see all groups and their states. Common issues include mismatched HSRP versions (use 'hsrp version 2' for consistency), authentication mismatches, or incorrect virtual IP addresses. The 'debug hsrp' command can provide real-time events, but use sparingly in production. Also verify that the interface is up/up and has IP connectivity between peers. If a group shows 'Init' state, it means the interface is down or no IP is configured. If 'Standby' state is missing, check for ACLs blocking HSRP multicast (224.0.0.2 for v1, 224.0.0.102 for v2). On NX-OS, HSRP uses UDP port 1985. Use 'show ip interface' to confirm the interface is routed. Finally, check object tracking if configured; a tracked object going down can cause priority changes. The 'show hsrp statistics' command can reveal packet drops or errors. In summary, systematic verification of feature enablement, interface status, and HSRP parameters will resolve most issues.
CCNA Exam Tips
Remember that 'feature hsrp' is required before any HSRP configuration; forgetting this is a common mistake in lab scenarios.
In CCNP exams, know that NX-OS uses 'feature' commands to enable protocols; this differs from IOS where HSRP is often enabled by default.
Be aware that 'no feature hsrp' disables HSRP and removes all HSRP configuration; use with caution.
Common Mistakes
Forgetting to issue 'feature hsrp' before configuring HSRP on interfaces, resulting in 'Invalid command' errors.
Using 'feature hsrp' in interface configuration mode instead of global configuration mode.
Assuming HSRP is enabled by default on NX-OS, leading to troubleshooting confusion.
Platform Notes
On Cisco NX-OS, features must be explicitly enabled with 'feature <protocol>' commands, unlike Cisco IOS where many features are enabled by default. This includes HSRP, VRRP, GLBP, OSPF, etc. The 'feature hsrp' command is global and does not require a reload. On IOS, HSRP is available without a feature command, though it may need to be enabled under certain license levels. NX-OS also supports HSRP version 2 by default when enabled, but you can switch to version 1 with 'hsrp version 1' under the interface. Another difference: NX-OS uses 'hsrp <group>' under interface configuration, while IOS uses 'standby <group>'. The command structure is similar but not identical. For example, setting the virtual IP on NX-OS is 'ip <address>' under 'hsrp <group>', whereas IOS uses 'standby <group> ip <address>'. Also, NX-OS supports HSRP for IPv6 with 'hsrp ipv6' commands. In terms of version differences, NX-OS 7.x and later support HSRPv2 with expanded group numbers (0-4095) and IPv6. Earlier versions may have limitations. For equivalent commands on other platforms: on Arista EOS, the command is 'feature hsrp' as well; on Juniper Junos, the equivalent is 'protocols hsrp' under interfaces. Understanding these platform nuances is important for multi-vendor environments.
Practice for the CCNA 200-301
Test your knowledge with hundreds of CCNA practice questions covering all exam domains.
Practice CCNA Questions