Implementing HSRP

The Hot Standby Router Protocol (HSRP) is an IP routing redundancy protocol designed to allow for transparent failover at the first-hop IP router. HSRP provides high network availability, because it routes IP traffic from hosts on networks without relying on the availability of any single router. HSRP is used in a group of routers for selecting an active router and a standby router. (An active router is the router of choice for routing packets; a standby router is a router that takes over the routing duties when an active router fails, or when preset conditions are met.)

Feature History for Implementing HSRP

Prerequisites for Implementing HSRP

You must be in a user group associated with a task group that includes the proper task IDs. The command reference guides include the task IDs required for each command. If you suspect user group assignment is preventing you from using a command, contact your AAA administrator for assistance.

Restrictions for Implementing HSRP

HSRP is supported on Ethernet interfaces, Ethernet sub-interfaces, Ethernet link bundles, and Bridge Virtual Interfaces (BVIs).

The following are restrictions for implementing HSRP:

  • HSRP sessions are not up by default. You can configure upto 255 (IPv4 and IPv6 combined) HSRP sessions per router using the hw-module vrrpscale enable command. Starting with Cisco IOS XR Release 7.1.1, HSRP is supported on the router. Reboot the router after configuring the command.

    For more information about the command, see VRRP Commands in the IP Addresses and Services Command Reference for Cisco NCS 5500 Series and NCS 540 and NCS 560 Series Routers.

  • Only one redundancy protocol supported at any time – either HSRP or VRRP.

  • HSRP is not supported on Cisco N540-24Q8L2DD-SYS router.

Information About Implementing HSRP

To implement HSRP on Cisco IOS XR software software, you need to understand the following concepts:

HSRP Overview

HSRP is useful for hosts that do not support a router discovery protocol (such as Internet Control Message Protocol [ICMP] Router Discovery Protocol [IRDP]) and cannot switch to a new router when their selected router reloads or loses power. Because existing TCP sessions can survive the failover, this protocol also provides a more transparent recovery for hosts that dynamically choose a next hop for routing IP traffic.

When HSRP is configured on a network segment, it provides a virtual MAC address and an IP address that is shared among a group of routers running HSRP. The address of this HSRP group is referred to as the virtual IP address. One of these devices is selected by the protocol to be the active router. The active router receives and routes packets destined for the MAC address of the group. For n routers running HSRP, n + 1 IP and MAC addresses are assigned.

HSRP detects when the designated active router fails, at which point a selected standby router assumes control of the MAC and IP addresses of the HSRP group. A new standby router is also selected at that time.

Devices that are running HSRP send and receive multicast User Datagram Protocol (UDP) based hello packets to detect router failure and to designate active and standby routers.

HSRP Groups

An HSRP group consists of two or more routers running HSRP that are configured to provide hot standby services for one another. HSRP uses a priority scheme to determine which HSRP-configured router is to be the default active router. To configure a router as the active router, you assign it a priority that is higher than the priority of all the other HSRP-configured routers. The default priority is 100, so if you configure just one router to have a higher priority, that router will be the default active router.

HSRP works by the exchange of multicast messages that advertise priority among the HSRP group. When the active router fails to send a hello message within a configurable period of time, the standby router with the highest priority becomes the active router. The transition of packet-forwarding functions between routers is completely transparent to all hosts on the network.

The following figure shows routers configured as members of a single HSRP group.

Figure 1. Routers Configured as an HSRP Group

All hosts on the network are configured to use the IP address of the virtual router (in this case, 1.0.0.3) as the default gateway.

A single router interface can also be configured to belong to more than one HSRP group. The following figure shows routers configured as members of multiple HSRP groups.

Figure 2. Routers Configured as Members of Multiple HSRP Groups

In the figure above, the Ethernet interface 0 of Router A belongs to group 1. Ethernet interface 0 of Router B belongs to groups 1, 2, and 3. The Ethernet interface 0 of Router C belongs to group 2, and the Ethernet interface 0 of Router D belongs to group 3. When you establish groups, you might want to align them along departmental organizations. In this case, group 1 might support the Engineering Department, group 2 might support the Manufacturing Department, and group 3 might support the Finance Department.

Router B is configured as the active router for groups 1 and 2 and as the standby router for group 3. Router D is configured as the active router for group 3. If Router D fails for any reason, Router B assumes the packet-transfer functions of Router D and maintains the ability of users in the Finance Department to access data on other subnets.


Note


A different virtual MAC address (VMAC) is required for each sub interface. VMAC is determined from the group ID. Therefore, a unique group ID is required for each sub interface configured, unless the VMAC is configured explicitly.



Note


We recommend that you disable Spanning Tree Protocol (STP) on switch ports to which the virtual routers are connected. Enable RSTP or rapid-PVST on the switch interfaces if the switch supports these protocols.


HSRP and ARP

When a router in an HSRP group goes active, it sends a number of ARP responses containing its virtual IP address and the virtual MAC address. These ARP responses help switches and learning bridges update their port-to-MAC maps. These ARP responses also provide routers configured to use the burned-in address of the interface as its virtual MAC address (instead of the preassigned MAC address or the functional address) with a means to update the ARP entries for the virtual IP address. Unlike the gratuitous ARP responses sent to identify the interface IP address when an interface comes up, the HSRP router ARP response packet carries the virtual MAC address in the packet header. The ARP data fields for IP address and media address contain the virtual IP and virtual MAC addresses.

Preemption

The HSRP preemption feature enables the router with highest priority to immediately become the active router. Priority is determined first by the priority value that you configure, and then by the IP address. In each case, a higher value is of greater priority.

When a higher-priority router preempts a lower-priority router, it sends a coup message. When a lower-priority active router receives a coup message or hello message from a higher-priority active router, it changes to the speak state and sends a resign message.

ICMP Redirect Messages

Internet Control Message Protocol (ICMP) is a network layer Internet protocol that provides message packets to report errors and other information relevant to IP processing. ICMP provides many diagnostic functions and can send and redirect error packets to the host. When running HSRP, it is important to prevent hosts from discovering the interface (or real) MAC addresses of routers in the HSRP group. If a host is redirected by ICMP to the real MAC address of a router, and that router later fails, then packets from the host are lost.

ICMP redirect messages are automatically enabled on interfaces configured with HSRP. This functionality works by filtering outgoing ICMP redirect messages through HSRP, where the next-hop IP address may be changed to an HSRP virtual IP address.

To support ICMP redirects, redirect messages are filtered through HSRP, where the next-hop IP address is changed to an HSRP virtual address. When HSRP redirects are turned on, ICMP interfaces with HSRP do this filtering. HSRP keeps track of all HSRP routers by sending advertisements and maintaining a real IP address to virtual IP address mapping to perform the redirect filtering.

How to Implement HSRP

This section contains instructions for the following tasks:

Enabling HSRP

The hsrp ipv4 command activates HSRP on the configured interface. If an IP address is specified, that address is used as the designated address for the Hot Standby group. If no IP address is specified, the virtual address is learned from the active router. For HSRP to elect a designated router, at least one router in the Hot Standby group must have been configured with, or learned, the designated address. Configuring the designated address on the active router always overrides a designated address that is currently in use.

Configuration Steps
  1. Enable HSRP interface configuration mode on a specific interface.

  2. Enable HSRP address-family configuration mode on a specific interface.

  3. Enable HSRP group submode.


    Note


    The version keyword is available only if IPv4 address-family is selected. By default, version is set to 2 for IPv6 address families.


  4. Activate HSRP on the configured interface.


    Note


    • If an IP address is specified, that address is used as the designated address for the Hot Standby group. If no IP address is specified, the virtual address is learned from the active router.

    • If you configure HSRP for IPv6, you must configure a link local IPv6 address or enable it using the autoconfig keyword. If you do not configure a linklocal IPv6 address, the router does not accept the configuration when you commit your changes using the commit keyword.


Configuration
/* Enable HSRP interface configuration mode on a specific interface. */
Router# configure
Router(config)# router hsrp
Router(config-hsrp)# interface <type> <interface-path-id>

/* Enable HSRP address-family configuration mode on a specific interface. */
Router(config-hsrp-if)# address-family ipv4

/* Enable HSRP group submode. */
Router(config-hsrp-ipv4)# hsrp <group-number> version <version-no>

/* Activate HSRP on the configured interface. */
Router(config-hsrp-gp)# address {learn|address[secondary]}
Router(config-hsrp-gp)# commit
Running Configuration
Router# show running-configuration
 router hsrp
 interface GigabitEthernet0/2/0/1
  address-family ipv4
   hsrp 1 version 1
    address learn
   !
   
Running Configuration for Extended Group Range
Router# show running-configuration
router hsrp
interface TenGigE 0/0/0/2
 address-family ipv4
  hsrp <1-4095> version <1-2>
  address 10.20.30.1
  address 10.20.30.2 secondary
!

Enabling HSRP for IPv6

Use the following steps to enable HSRP for IPv6.

  1. Enable HSRP interface configuration mode on a specific interface.

  2. Enable HSRP address-family configuration mode on a specific interface.

  3. Enable HSRP group submode.


    Note


    The version keyword is available only if IPv4 address-family is selected. By default, version is set to 2 for IPv6 address families.


  4. Activate HSRP on the configured interface and assigns a linklocal IPv6 address..


    Note


    • The virtual linklocal address must not match any other virtual linklocal address that is already configured for a different group.

    • The virtual linklocal address must not match the interface linklocal IPv6 address.

    • If you use the autoconfig keyword, the linklocal address is calculated using the EUI-64 format.

    • Use the legacy-compatible keyword to be compatible with Cisco IOS and other legacy Cisco devices.


  5. Activate HSRP on the configured interface and assigns a global IPv6 address.


    Note


    If you configure HSRP for IPv6, you must configure a link local IPv6 address or enable it using the autoconfig keyword. If you do not configure a linklocal IPv6 address, the router does not accept the configuration when you commit your changes using the commit keyword.


Configuration
/* Enable HSRP interface configuration mode on a specific interface. */
Router# configure
Router(config)# router hsrp
Router(config-hsrp)# interface <type> <interface-path-id>

/* Enable HSRP address-family configuration mode on a specific interface. */
Router(config-hsrp-if)# address-family ipv4

/* Enable HSRP group submode. */
Router(config-hsrp-ipv4)# hsrp <group-number>

/* Activate HSRP on the configured interface. */
Router(config-hsrp-gp)# address global <ipv6-address>
Router(config-hsrp-gp)# commit
Running Configuration
Router# show running-configuration
configure
 router hsrp
 interface GigabitEthernet0/2/0/1
  address-family ipv4
   hsrp 1
    address linklocal autoconfig
    address global 2001:DB8:A:B::1
   !
Running Configuration for Expanded Group Range
Router# show running-configuration
router hsrp
interface TenGigE 0/0/0/2
 address-family ipv6
  hsrp <1-4095>
  address global 1:1::1
  address linklocal autoconfig
!

Configuring HSRP Group Attributes

To configure other Hot Standby group attributes that affect how the local router participates in HSRP, use the following procedure in interface configuration mode as needed:

Configuration Example
  1. Enable HSRP configuration mode.

  2. Enable HSRP interface configuration mode on a specific interface.

  3. Enable HSRP address-family configuration mode on a specific interface.

  4. Enable HSRP group submode.


    Note


    The version keyword is available only if IPv4 address-family is selected. By default, version is set to 2 for IPv6 address families.


  5. (Optional) Configure HSRP priority.

    • The assigned priority is used to help select the active and standby routers. Assuming that preemption is enabled, the router with the highest priority becomes the designated active router. In case of ties, the primary IP addresses are compared, and the higher IP address has priority.

    • The priority of the device can change dynamically if an interface is configured with the track command and another interface on the device goes down.

    • If preemption is not enabled using the preempt command, the router may not become active even though it might have a higher priority than other HSRP routers.

    • To restore the default HSRP priority values, use the no priority command.

  6. (Optional) Configure an interface so that the Hot Standby priority changes on the basis of the availability of other interfaces.

    • When a tracked interface goes down, the Hot Standby priority decreases by 10. If an interface is not tracked, its state changes do not affect the Hot Standby priority. For each interface configured for Hot Standby, you can configure a separate list of interfaces to be tracked.

    • The optional priority-decrement argument specifies by how much to decrement the Hot Standby priority when a tracked interface goes down. When the tracked interface comes back up, the priority is incrementally increased by the same amount.

    • When multiple tracked interfaces are down and the priority-decrement argument has been configured, these configured priority decrements are cumulative. If tracked interfaces are down, but none of them were configured with priority decrements, the default decrement is 10 and it is cumulative.

    • The preempt command must be used in conjunction with this command on all routers in the group whenever the best available router should be used to forward packets. If the preempt command is not used, the active router stays active, regardless of the current priorities of the other HSRP routers.

    • To remove the tracking, use the no preempt command.

  7. (Optional) Configure HSRP preemption and preemption delay.

    • When you configure preemption and preemption delay with the preempt command, the local router attempts to assume control as the active router when the local router has a Hot Standby priority higher than the current active router. If the preempt command is not configured, the local router assumes control as the active router only if it receives information indicating that no router is currently in the active state (acting as the designated router).

    • When a router first comes up, it does not have a complete routing table. If it is configured to preempt, it becomes the active router, yet it is unable to provide adequate routing services. This problem can be solved by configuring a delay before the preempting router actually preempts the currently active router.

    • The preempt delay seconds value does not apply if there is no router currently in the active state. In this case, the local router becomes active after the appropriate timeouts (see the timers command), regardless of the preempt delay seconds value.

    • To restore the default HSRP preemption and preemption delay values, use the no preempt command.

  8. (Optional) Configure an authentication string for the Hot Standby Router Protocol (HSRP).

    • The authentication string is sent unencrypted in all HSRP messages. The same authentication string must be configured on all routers and access servers on a LAN to ensure interoperation.

    • Authentication mismatch prevents a device from learning the designated Hot Standby IP address and the Hot Standby timer values from other routers configured with HSRP.

    • Authentication mismatch does not prevent protocol events such as one router taking over as the designated router.

    • To delete an authentication string, use the no authentication command.

Configuration
/* Enable HSRP configuration mode. */
Router# configure
Router(config)# router hsrp

/* Enable HSRP interface configuration mode on a specific interface. */
Router(config-hsrp)# interface <type> <interface-path-id>

/* Enable HSRP address-family configuration mode on a specific interface. */
Router(config-hsrp-if)# address-family ipv4

/* Enable HSRP group submode. */
Router(config-hsrp-ipv4)# hsrp <group-number> version <version-no>

/* (Optional) Configure HSRP priority. */
Router(config-hsrp-gp)# priority <priority>

/* (Optional) Configure an interface so that the Hot Standby priority changes on the basis of the availability of other interfaces. */
Router(config-hsrp-gp)# track <type> instance <priority-decrement>

/* (Optional) Configure an authentication string for the Hot Standby Router Protocol (HSRP). */
Router(config-hsrp-gp)# authentication <string>
Running Configuration
Router# show running-configuration
configure
router hsrp
 interface TenGigE0/2/0/1
  address-family ipv4
   hsrp 1 version 1
    priority 100
    track TenGigE0/3/0/1
    preempt
    authentication company1
   !
  !
 !
!

Configuring the HSRP Activation Delay

The activation delay for HSRP is designed to delay the startup of the state machine when an interface comes up. This give the network time to settle and avoids unnecessary state changes early after the link comes up.

Configuration Example
  1. Enable HSRP configuration mode.

  2. Enable HSRP interface configuration mode on a specific interface.

  3. Configure the delay of startup of the state machine.


    Note


    The reload delay is the delay applied after the first interface up event. The minimum delay is the delay that is applied after any subsequent interface up event (if the interface flaps).


  4. Enable HSRP address-family configuration mode on a specific interface.

  5. Enable HSRP group submode.

  6. Activate HSRP on the configured interface.


    Note


    • If an IP address is specified, that address is used as the designated address for the Hot Standby group. If no IP address is specified, the virtual address is learned from the active router.

    • If you configure HSRP for IPv6, you must configure a link local IPv6 address or enable it using the autoconfig keyword. If you do not configure a linklocal IPv6 address, the router does not accept the configuration when you commit your changes using the commit keyword.


Configuration
/* Enable HSRP configuration mode. */
Router# configure
Router(config)# router hsrp

/* Enable HSRP interface configuration mode on a specific interface. */
Router(config-hsrp)# interface <type> <interface-path-id>

/* Configure the delay of startup of the state machine. */
Router(config-hsrp-if)# hsrp delay minimum <seconds> reload <seconds>

/* Enable HSRP address-family configuration mode on a specific interface. */
Router(config-hsrp-if)# address-family ipv4

/* Enable HSRP group submode. */
Router(config-hsrp-ipv4)# hsrp <group-number> version <version-no>

/* Activate HSRP on the configured interface. */
Router(config-hsrp-gp)# address { learn | address [secondary] }
Router(config-hsrp-gp)# commit
Running Configuration
Router# show running-configuration
configure
router hsrp
 interface TenGigE0/2/0/1
  hsrp delay minimum 2 reload 10
  address-family ipv4
   hsrp 1
    address learn
   !

Disabling HSRP Support for ICMP Redirect Messages

By default, HSRP filtering of ICMP redirect messages is enabled on routers running HSRP.

To configure the reenabling of this feature on your router if it is disabled, use the hsrp redirects command in interface configuration mode.

Configuration Example
  1. Enable HSRP interface configuration mode on a specific interface.

  2. Enable HSRP address-family configuration mode on a specific interface.

  3. Enable HSRP group submode.


    Note


    The version keyword is available only if IPv4 address-family is selected. By default, version is set to 2 for IPv6 address families.


  4. Activate HSRP on the configured interface.


    Note


    • If an IP address is specified, that address is used as the designated address for the Hot Standby group. If no IP address is specified, the virtual address is learned from the active router.

    • If you configure HSRP for IPv6, you must configure a link local IPv6 address or enable it using the autoconfig keyword. If you do not configure a linklocal IPv6 address, the router does not accept the configuration when you commit your changes using the commit keyword.


  5. Configure Internet Control Message Protocol (ICMP) redirect messages to be sent when the Hot Standby Router Protocol (HSRP) is configured on an interface.


    Note


    • The hsrp redirects command can be configured on a per-interface basis. When HSRP is first configured on an interface, the setting for that interface inherits the global value. If ICMP redirects have been explicitly disabled on an interface, then the global command cannot reenable the functionality.

    • With the hsrp redirects command enabled, ICMP redirect messages are filtered by replacing the real IP address in the next-hop address of the redirect packet with a virtual IP address, if it is known to HSRP.

    • To revert to the default, which is that ICMP messages are enabled, use the no hsrp redirects command.


Configuration
/* Enable HSRP interface configuration mode on a specific interface. */
Router# configure
Router(config)# router hsrp
Router(config-hsrp)# interface <type> <interface-path-id>

/* Configure Internet Control Message Protocol (ICMP) redirect messages to be sent when the Hot Standby Router Protocol (HSRP) is configured on an interface. */
Router(config-hsrp-gp)# hsrp redirects disable

/* Enable HSRP address-family configuration mode on a specific interface. */
Router(config-hsrp-if)# address-family ipv4

/* Enable HSRP group submode. */
Router(config-hsrp-ipv4)# hsrp <group-number> version <version-no>

/* Activate HSRP on the configured interface. */
Router(config-hsrp-gp)# address {learn|address[secondary]}

Running Configuration
Router# show running-configuration
router hsrp
 interface TenGigE 0/2/0/1
  address-family ipv4
   hsrp 1 version 1
    address learn
   !
  !
  hsrp redirects disable
 !
!

Multiple Group Optimization (MGO) for HSRP

Multiple Group Optimization provides a solution for reducing control traffic in a deployment consisting of many subinterfaces. By running the HSRP control traffic for just one of the sessions, the control traffic is reduced for the subinterfaces with identical redundancy requirements. All other sessions are subordinates of this primary session, and inherit their states from it.

Customizing HSRP

Customizing the behavior of HSRP is optional. Be aware that as soon as you enable a HSRP group, that group is in operation.

Configuration Example
  1. Enable HSRP interface configuration mode on a specific interface.

  2. Enable HSRP address-family configuration mode on a specific interface.

  3. Enable HSRP group submode.


    Note


    The version keyword is available only if IPv4 address-family is selected. By default, version is set to 2 for IPv6 address families.


  4. Configure an HSRP session name.

  5. Enables hot standby protocol for IP.


    Note


    If an IP address is specified, that address is used as the designated address for the Hot Standby group. If no IP address is specified, the virtual address is learned from the active router.


  6. Configure the secondary virtual IPv4 address for a router.

  7. Configure an authentication string for the Hot Standby Router Protocol (HSRP).

  8. Enable HSRP slave configuration mode on a specific interface.

  9. Configure the subordinate group to inherit its state from a specified group.

  10. Configure the primary virtual IPv4 address for the subordinate group.

Configuration
/* Enable HSRP interface configuration mode on a specific interface. */
Router# configure
Router(config)# router hsrp
Router(config-hsrp)# interface <type> <interface-path-id>

/* Enable HSRP address-family configuration mode on a specific interface. */
Router(config-hsrp-if)# address-family ipv4

/* Enable HSRP group configuration mode on a specific interface. */
Router(config-hsrp-ipv4)# hsrp <group-no> version <version-no>

/* Configure an HSRP session name. */
Router(config-hsrp-gp)# name <name>

/* Enable hot standby protocol for IP. */
Router(config-hsrp-gp)# address { learn | address}

/* Configure the secondary virtual IPv4 address for a router. */
Router(config-hsrp-gp)# address <address> secondary

/* Configures an authentication string for the Hot Standby Router Protocol (HSRP). */
Router(config-hsrp-gp)# authentication <string>

/* Enables HSRP slave configuration mode on a specific interface. */
Router(config-hsrp-gp)# hsrp <group-no> slave

/* Configure the subordinate group to inherit its state from a specified group. */
Router(config-hsrp-slave)# follow mgo-session-name

/* Configure the primary virtual IPv4 address for the subordinate group.
Router(config-hsrp-slave)# address <ip-address>

Running Configuration
Router# show running-configuration
router hsrp
 interface TenGigE0/2/0/1
  address-family ipv4
   hsrp 1 version 1
    name s1
     address learn
     address 1198.51.100.1 secondary
     authentication company1
     hsrp 2 slave
      follow s1
      address 192.0.2.1
     !
   !
  !
 !
!

Configuring a Primary Virtual IPv4 Address

To enable hot standby protocol for IP, use the address (hsrp) command in the HSRP group submode.

Configuration Example
  1. Enable HSRP interface configuration mode on a specific interface.

  2. Enable HSRP address-family configuration mode on a specific interface.

  3. Enable HSRP group configuration mode on a specific interface.


    Note


    • The version keyword is available only if IPv4 address-family is selected. By default, version is set to 2 for IPv6 address families.

    • The HSRP version 2 extended group range must be restricted to 0-255, even though the configuration up to 0-4095 is accepted.


  4. Enable hot standby protocol for IP.

Configuration
/* Enable HSRP interface configuration mode on a specific interface. */
Router# configure
Router(config)# router hsrp
Router(config-hsrp)# interface <type> <interface-path-id>

/* Enable HSRP address-family configuration mode on a specific interface. */
Router(config-hsrp-if)# address-family ipv4

/* Enable HSRP group configuration mode on a specific interface. */
Router(config-hsrp-ipv4)# hsrp <group-number> version <version-no>

/* Enable hot standby protocol for IP. */
Router(config-hsrp-ipv4)# address { learn | address }
Running Configuration
Router# show running-configuration
router hsrp
 interface TenGigE 0/2/0/1
  address-family ipv4
   hsrp 1 version 1
    address learn
   !
  !
 !
!

Configuring a Secondary Virtual IPv4 Address

To configure the secondary virtual IPv4 address for a router, use the address secondary command in the Hot Standby Router Protocol (HSRP) virtual router submode.

Configuration Example
  1. Enable HSRP interface configuration mode on a specific interface.

  2. Enable HSRP address-family configuration mode on a specific interface.

  3. Enable HSRP group configuration mode on a specific interface.


    Note


    • The version keyword is available only if IPv4 address-family is selected. By default, version is set to 2 for IPv6 address families.

    • The HSRP version 2 extended group range must be restricted to 0-255, even though the configuration up to 0-4095 is accepted.


  4. Configure the secondary virtual IPv4 address for a router.

Configuration
/* Enable HSRP interface configuration mode on a specific interface. */
Router# configure
Router(config)# router hsrp
Router(config-hsrp)# interface <type> <interface-path-id>

/* Enable HSRP address-family configuration mode on a specific interface. */
Router(config-hsrp-if)# address-family ipv4

/* Enable HSRP group configuration mode on a specific interface. */
Router(config-hsrp-ipv4)# hsrp <group-number> version <version-no>

/* Configure the secondary virtual IPv4 address for a router. */
Router(config-hsrp-ipv4)# address <address> secondary
Running Configuration
Router# show running-configuration
router hsrp
 interface TenGigE 0/2/0/1
  address-family ipv4
   hsrp 1 version 1
    192.0.2.1
   !
  !
 !
!

Configuring the Subordinate Group to Inherit its State from a Specified Group

To instruct the subordinate group to inherit its state from a specified group, use the hsrp slave follow command in HSRP slave submode mode.
Configuration Example
  1. Enable HSRP interface configuration mode on a specific interface.

  2. Enable HSRP address-family configuration mode on a specific interface.

  3. Enable HSRP slave configuration mode on a specific interface.

  4. Configure the subordinate group to inherit its state from a specified group.

Configuration
/* Enable HSRP interface configuration mode on a specific interface. */
Router# configure
Router(config)# router hsrp
Router(config-hsrp)# interface <type> <interface-path-id>

/* Enable HSRP address-family configuration mode on a specific interface. */
Router(config-hsrp-if)# address-family ipv4

/* Enable HSRP slave configuration mode on a specific interface. */
Router(config-hsrp-ipv4)# hsrp <group-no> slave

/* Configure the subordinate group to inherit its state from a specified group. */
Router(config-hsrp-slave)# address <ip-address>
Running Configuration
Router# show running-configuration
router hsrp
 interface TenGigE 0/2/0/1
  address-family ipv4
   hsrp 1 slave
    address 192.0.2.1
   !
  !
 !
!

Configuring a Subordinate Primary Virtual IPv4 Address

To configure the primary virtual IPv4 address for the subordinate group, use the subordinate primary virtual IPv4 address command in the HSRP slave submode.

Configuration Example
  1. Enable HSRP interface configuration mode on a specific interface.

  2. Enable HSRP address-family configuration mode on a specific interface.

  3. Enable HSRP slave configuration mode on a specific interface.

  4. Configure the primary virtual IPv4 address for the subordinate group.

Configuration
/* Enable HSRP interface configuration mode on a specific interface. */
Router# configure
Router(config)# router hsrp
Router(config-hsrp)# interface <type> <interface-path-id>

/* Enable HSRP address-family configuration mode on a specific interface. */
Router(config-hsrp-if)# address-family ipv4

/* Enable HSRP slave configuration mode on a specific interface. */
Router(config-hsrp-ipv4)# hsrp <group-no> slave

/* Configure the primary virtual IPv4 address for the subordinate group. */
Router(config-hsrp-slave)# address <ip-address>
Running Configuration
Router# show running-configuration
router hsrp
 interface TenGigE 0/2/0/1
  address-family ipv4
   hsrp 1 slave
    address 192.0.2.1
   !
  !
 !
!

Configuring a Secondary Virtual IPv4 address for the Subordinate Group

Perform this task to configure the secondary virtual IPv4 address for the subordinate group.

Configuration Example
  1. Enable HSRP interface configuration mode on a specific interface.

  2. Enable HSRP address-family configuration mode on a specific interface.

  3. Enable HSRP slave configuration mode on a specific interface.

  4. Configure the secondary virtual IPv4 address for a router.

Configuration
/* Enable HSRP interface configuration mode on a specific interface. */
Router# configure
Router(config)# router hsrp
Router(config-hsrp)# interface <type> <interface-path-id>

/* Enable HSRP address-family configuration mode on a specific interface. */
Router(config-hsrp-if)# address-family ipv4

/* Enable HSRP slave configuration mode on a specific interface. */
Router(config-hsrp-ipv4)# hsrp <group-no> slave

/* Configure the secondary virtual IPv4 address for the subordinate group. */
Router(config-hsrp-slave)# address <ip-address> secondary
Running Configuration
Router# show running-configuration
router hsrp
 interface TenGigE 0/2/0/1
  address-family ipv4
   hsrp 1 slave
    address 192.0.2.1 secondary
   !
  !
 !
!

Configuring a Subordinate Virtual MAC Address

To configure the virtual MAC address for the subordinate group, use the subordinate virtual mac address command in the HSRP slave submode.

Configuration Example
  1. Enable HSRP interface configuration mode on a specific interface.

  2. Enable HSRP address-family configuration mode on a specific interface.

  3. Enable HSRP slave configuration mode on a specific interface.

Configuration
/* Enable HSRP interface configuration mode on a specific interface. */
Router# configure
Router(config)# router hsrp
Router(config-hsrp)# interface <type> <interface-path-id>

/* Enable HSRP address-family configuration mode on a specific interface. */
Router(config-hsrp-if)# address-family ipv4

/* Enable HSRP slave configuration mode on a specific interface. */
Router(config-hsrp-ipv4)# hsrp <group-no> slave
Running Configuration
Router# show running-configuration
router hsrp
 interface TenGigE 0/2/0/1
  address-family ipv4
   hsrp 1 slave
   !
  !
 !
!

Configuring an HSRP Session Name

To configure an HSRP session name, use the session name command in the HSRP group submode.

Configuration Example
  1. Enable HSRP interface configuration mode on a specific interface.

  2. Enable HSRP address-family configuration mode on a specific interface.

  3. Enable HSRP group configuration mode on a specific interface.


    Note


    • The version keyword is available only if IPv4 address-family is selected. By default, version is set to 2 for IPv6 address families.

    • The HSRP version 2 extended group range must be restricted to 0-255, even though the configuration up to 0-4095 is accepted.


  4. Configure the subordinate group to inherit its state from a specified group.

Configuration
/* Enable HSRP interface configuration mode on a specific interface. */
Router# configure
Router(config)# router hsrp
Router(config-hsrp)# interface <type> <interface-path-id>

/* Enable HSRP address-family configuration mode on a specific interface. */
Router(config-hsrp-if)# address-family ipv4

/* Enable HSRP group configuration mode on a specific interface. */
Router(config-hsrp-ipv4)# hsrp <group-no> hsrp <version-no>

/* Configure the subordinate group to inherit its state from a specified group. */
Router(config-hsrp-ipv4)# name <name>
Running Configuration
Router# show running-configuration
router hsrp
 interface TenGigE 0/2/0/1
  address-family ipv4
   hsrp 1 version 2
    name s1   !
  !
 !
!

BFD for HSRP

Bidirectional Forwarding Detection (BFD) is a network protocol used to detect faults between two forwarding engines. BFD sessions operate in asynchronous mode. In asynchronous mode, both endpoints periodically send hello packets to each other. If a number of those packets are not received, the session is considered down.

Advantages of BFD

  • BFD provides failure detection in less than one second.

  • BFD supports all types of encapsulation.

  • BFD is not tied to any particular routing protocol, supports almost all routing protocols.

BFD Process

HSRP uses BFD to detect link failure and facilitate fast failover times without excessive control packet overhead.

The HSRP process creates BFD sessions as required. When a BFD session goes down, each Standby group monitoring the session transitions to Active state.

HSRP doesn't participate in any state elections for 10 seconds, after a transition to Active state that a BFD session going down triggers.

Enabling BFD

Router# configure

Router(config)# router hsrp

Router(config-hsrp)# interface <type> <interface-path-id>

Router(config-hsrp-if)# address-family ipv4

Router(config-hsrp-ipv4)# hsrp[group number] version <version-no> bfd fast-detect [peer ipv4 <ipv4-address> <interface-type> <interface-path-id>]

commit

Modifying BFD timers (minimum interval)

Minimum interval determines the frequency of sending BFD packets to BFD peers (in milliseconds). The default minimum interval is 15ms.

Router# configure

Router(config)# router hsrp

Router(config-hsrp)# interface <type> <interface-path-id>

Router(config-hsrp-if)# hsrp bfd minimum-interval <interval>

router(config-hsrp-if)# address-family ipv4

commit

Modifying BFD timers (multiplier)

Router# configure

Router(config)# router hsrp

Router(config-hsrp)# interface <type> <interface-path-id>

Router(config-hsrp-if)# hsrp bfd multiplier <multiplier>

Router(config-hsrp-if)# address-family ipv4

commit

Enhanced Object Tracking for HSRP and IP Static

A failure between the active router and the core network cannot be detected using standard HSRP failure detection mechanisms. Object tracking is used to detect such failures. When such a failure occurs, the active router applies a priority decrement to its HSRP session. If this causes its priority to fall below that of the standby router, it will detect this from the HSRP control traffic, and then use this as a trigger to preempt and take over the active role.

Cisco IOS XR software supports up to 512 tracked objects.

The enhanced object tracking for HSRP and IP Static feature provides first-hop redundancy as well as default gateway selection based on IP Service Level Agreement (IPSLA).

See the Routing Configuration Guide for Cisco NCS 540 Series Routers, for more information about enhanced object tracking for static routes.

Configuring object tracking for HSRP

To enable tracking of the named object with the specified decrement, use the following configuration in the HSRP group sub mode.

Configuration Example
  1. Enable HSRP interface configuration mode on a specific interface.

  2. Enable HSRP address-family configuration mode on a specific interface.

  3. Enable HSRP group sub-mode on a specific interface.


    Note


    The version keyword is available only if IPv4 address-family is selected. By default, version is set to 2 for IPv6 address families.


  4. Enable tracking of the named object with the specified decrement.

Configuration
/* Enable HSRP interface configuration mode on a specific interface. */
Router# configure
Router(config)# router hsrp
Router(config-hsrp)# interface <type> <interface-path-id>

/* Enable HSRP address-family configuration mode on a specific interface. */
Router(config-hsrp-if)# address-family ipv4

/* Enable HSRP group sub-mode on a specific interface. */
Router(config-hsrp-ipv4)# hsrp <group-no> hsrp <version-no>

/* Enable tracking of the named object with the specified decrement. */
Router(config-hsrp-gp)# track object <name> [priority-decrement]
Running Configuration
Router# show running-configuration
router hsrp
 interface TenGigE 0/2/0/1
  address-family ipv4
   hsrp 1 version 1
    track object t1 2
   !
  !
 !
!

Hot Restartability for HSRP

In the event of failure of a HSRP process in one active group, forced failovers in peer HSRP active router groups should be prevented. Hot restartability supports warm RP failover without incurring forced failovers to peer HSRP routers for active groups.

Configuration Examples for HSRP Implementation on Software

This section provides the following HSRP configuration examples:

Configuring an HSRP Group: Example

The following is an example of enabling HSRP on an interface and configuring HSRP group attributes:


configure
router hsrp
interface 0/2/0/1
hsrp 1 ipv4 1.0.0.5
commit
hsrp 1 timers 100 200
hsrp 1 preempt delay 500
hsrp priority 20
hsrp track  0/2/0/2
hsrp 1 authentication company0
hsrp use-bia
commit

Configuring a Router for Multiple HSRP Groups: Example

The following is an example of configuring a router for multiple HSRP groups:


configure
router hsrp
interface  0/2/0/3
hsrp 1 ipv4 1.0.0.5
hsrp 1 priority 20
hsrp 1 preempt
hsrp 1 authentication sclara
hsrp 2 ipv4 1.0.0.6 
hsrp 2 priority 110
hsrp 2 preempt
hsrp 2 authentication mtview
hsrp 3 ipv4 1.0.0.7
hsrp 3 preempt
hsrp 3 authentication svale
commit