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.
bashRouter> enable
Router# configure terminal
2. Configure HSRP on an Interface:
- Description: Configure HSRP on an interface. Replace
interface_typewith the actual interface type (e.g., GigabitEthernet) andinterface_numberwith the interface number (e.g., 0/0).
bashRouter(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:
bashRouter(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_numberas the active router. This ensures both routers participate in HSRP.
bashRouter(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:
bashRouter(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:
bashRouter# 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.
bashRouter# 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.
bashSwitch> enable
Switch# configure terminal
2. Configure HSRP on an Interface:
- Description: Configure HSRP on a VLAN interface. Replace
vlan_idwith the actual VLAN ID you want to configure,interface_typewith the actual interface type (e.g., VLAN interface), andinterface_numberwith the interface number (e.g., 10).
bashSwitch(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:
bashSwitch(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_numberas the active switch. This ensures that both switches participate in HSRP.
bashSwitch(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:
bashSwitch(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:
bashSwitch# 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.
bashSwitch# 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
Post a Comment