HSRP (Hot Standby Router Protocol ) on Router and Switch

HSRP on Router


 Hot Standby Router Protocol (HSRP) is a Cisco proprietary protocol used for providing high availability and redundancy in a network by allowing multiple routers to work together as a single virtual router. Here are the commands to configure HSRP along with descriptions and a use case:

Use Case for HSRP: Consider a scenario where you have two routers, Router A and Router B, connected to the same LAN segment. You want to ensure that if Router A fails, Router B can seamlessly take over to provide network connectivity. HSRP can be used to achieve this high availability setup.

1. Access Configuration Mode:

  • Description: Access the router's command-line interface (CLI) and enter configuration mode.
bash
Router> enable Router# configure terminal

2. Configure HSRP on an Interface:

  • Description: Configure HSRP on an interface. Replace interface_type with the actual interface type (e.g., GigabitEthernet) and interface_number with the interface number (e.g., 0/0).
bash
Router(config)# interface interface_type interface_number Router(config-if)# standby group_number ip virtual_ip Router(config-if)# standby group_number priority priority_value Router(config-if)# standby group_number preempt
  • Example:
bash
Router(config)# interface GigabitEthernet0/0 Router(config-if)# standby 1 ip 192.168.1.1 Router(config-if)# standby 1 priority 110 Router(config-if)# standby 1 preempt
  • Description:
    • standby group_number ip virtual_ip: Specifies the virtual IP address that will be shared between the routers.
    • standby group_number priority priority_value: Sets the priority for the router. The router with the highest priority becomes the active router.
    • standby group_number preempt: Enables the router to preempt the active role if it has a higher priority.

3. Configure HSRP on the Backup Router:

  • Description: Configure HSRP on the backup router using the same group_number as the active router. This ensures both routers participate in HSRP.
bash
Router(config)# interface interface_type interface_number Router(config-if)# standby group_number ip virtual_ip Router(config-if)# standby group_number priority lower_priority_value Router(config-if)# standby group_number preempt
  • Example:
bash
Router(config)# interface GigabitEthernet0/0 Router(config-if)# standby 1 ip 192.168.1.1 Router(config-if)# standby 1 priority 100 Router(config-if)# standby 1 preempt

4. Verify HSRP Configuration:

  • Description: To verify the HSRP configuration on the router, you can use the following command:
bash
Router# show standby
  • Description: This command displays the current HSRP status, including the active and standby routers, virtual IP address, and priority.

5. Save the Configuration:

  • Description: After configuring HSRP, be sure to save the configuration to the startup configuration to ensure it persists after a reboot.
bash
Router# write memory

In this use case, HSRP ensures high availability by allowing Router A and Router B to share a virtual IP address. Router A becomes the active router because it has a higher priority, and if it fails or goes down, Router B takes over automatically, providing uninterrupted network connectivity.


===========================================================

HSRP on Switch

Hot Standby Router Protocol (HSRP) is used for providing high availability and redundancy in a network by allowing multiple routers or switches to work together as a single virtual router. Here are the commands to configure HSRP on a Cisco switch, along with descriptions and a use case:

Use Case for HSRP on a Switch: Imagine a scenario where you have two Cisco switches, Switch A and Switch B, connected to the same LAN segment. You want to ensure that if Switch A fails, Switch B can take over to provide network connectivity seamlessly. HSRP can be used to achieve this high availability setup.

1. Access Configuration Mode:

  • Description: Access the switch's command-line interface (CLI) and enter configuration mode.
bash
Switch> enable Switch# configure terminal

2. Configure HSRP on an Interface:

  • Description: Configure HSRP on a VLAN interface. Replace vlan_id with the actual VLAN ID you want to configure, interface_type with the actual interface type (e.g., VLAN interface), and interface_number with the interface number (e.g., 10).
bash
Switch(config)# interface vlan vlan_id Switch(config-if)# standby group_number ip virtual_ip Switch(config-if)# standby group_number priority priority_value Switch(config-if)# standby group_number preempt
  • Example:
bash
Switch(config)# interface vlan 10 Switch(config-if)# standby 1 ip 192.168.1.1 Switch(config-if)# standby 1 priority 110 Switch(config-if)# standby 1 preempt
  • Description:
    • standby group_number ip virtual_ip: Specifies the virtual IP address that will be shared between the switches.
    • standby group_number priority priority_value: Sets the priority for the switch. The switch with the highest priority becomes the active switch.
    • standby group_number preempt: Enables the switch to preempt the active role if it has a higher priority.

3. Configure HSRP on the Backup Switch:

  • Description: Configure HSRP on the backup switch using the same group_number as the active switch. This ensures that both switches participate in HSRP.
bash
Switch(config)# interface vlan vlan_id Switch(config-if)# standby group_number ip virtual_ip Switch(config-if)# standby group_number priority lower_priority_value Switch(config-if)# standby group_number preempt
  • Example:
bash
Switch(config)# interface vlan 10 Switch(config-if)# standby 1 ip 192.168.1.1 Switch(config-if)# standby 1 priority 100 Switch(config-if)# standby 1 preempt

4. Verify HSRP Configuration:

  • Description: To verify the HSRP configuration on the switch, you can use the following command:
bash
Switch# show standby
  • Description: This command displays the current HSRP status, including the active and standby switches, virtual IP address, and priority.

5. Save the Configuration:

  • Description: After configuring HSRP, be sure to save the configuration to the startup configuration to ensure it persists after a reboot.
bash
Switch# write memory

In this use case, HSRP ensures high availability by allowing Switch A and Switch B to share a virtual IP address. Switch A becomes the active switch because it has a higher priority, and if it fails or goes down, Switch B takes over automatically, providing uninterrupted network connectivity.

Comments

Popular posts from this blog

CCNA Router and Catalyst Switch IOS Command Reference

Network Technologies

About myself