Switching - Hot Standby Router Protocol
Hot Standby Router Protocol
The Hot Standby Router Protocol (HSRP) is a Cisco proprietary protocol designed to provide high availability and fault tolerance for IP networks. Although traditionally associated with routers, HSRP can have implications in switching environments, particularly in scenarios where switches are integrated with routing functionalities. In an HSRP setup, multiple routers or layer 3 switches work together to present a virtual IP address and MAC address as a single default gateway to the connected devices. One router assumes the active role and forwards traffic, while the others remain in standby. If the active router fails, HSRP dynamically and seamlessly transfers the responsibilities to one of the standby routers, ensuring uninterrupted network connectivity. While HSRP is primarily a routing protocol, its integration with layer 3 switches in a switched environment can enhance overall network reliability by providing redundant routing capabilities.
Lab:
HSRP Topology
Task 1: Configure HSRP for IPv4
Step 1: Configure HSRP Basic Configuration
R1:
interface f0/0
ip address 10.0.0.1 255.255.255.0
no shutdown
exit
ip route 100.0.0.0 255.0.0.0 10.0.0.5
R2:
interface f0/0
ip address 10.0.0.2 255.255.255.0
no shutdown
exit
interface serial 1/0
ip address 20.0.0.2 255.255.255.0
no shutdown
exit
ip route 100.0.0.0 255.0.0.0 20.0.0.4
interface f0/0
standby 1 ip 10.0.0.5
exit
R3:
interface f0/0
ip address 10.0.0.3 255.255.255.0
no shutdown
exit
interface serial 1/0
ip address 30.0.0.3 255.255.255.0
no shutdown
exit
ip route 100.0.0.0 255.0.0.0 30.0.0.4
interface f0/0
standby 1 ip 10.0.0.5
exit
R4:
interface serial 1/0
ip address 20.0.0.4 255.255.255.0
no shutdown
exit
interface serial 1/2
ip address 30.0.0.4 255.255.255.0
no shutdown
exit
interface loopback 1
ip address 100.100.100.100 255.255.255.0
exit
ip route 0.0.0.0 0.0.0.0 20.0.0.2
ip route 0.0.0.0 0.0.0.0 30.0.0.3
Task 2: Verification
Step 1: Verify Active and Standby State in HSRP
R2:
R2#show standby
FastEthernet0/0 - Group 1
State is Active
2 state changes, last state change 00:23:16
Virtual IP address is 10.0.0.5
Active virtual MAC address is 0000.0c07.ac01
Local virtual MAC address is 0000.0c07.ac01 (v1 default)
Hello time 3 sec, hold time 10 sec
Next hello sent in 1.608 secs
Preemption disabled
Active router is local
Standby router is 10.0.0.3, priority 100 (expires in 8.196 sec)
Priority 100 (default 100)
Group name is "hsrp-Fa0/0-1" (default)
R3:
R3#show standby
FastEthernet0/0 - Group 1
State is Standby
1 state change, last state change 00:00:14
Virtual IP address is 10.0.0.5
Active virtual MAC address is 0000.0c07.ac01
Local virtual MAC address is 0000.0c07.ac01 (v1 default)
Hello time 3 sec, hold time 10 sec
Next hello sent in 0.260 secs
Preemption disabled
Active router is 10.0.0.2, priority 100 (expires in 9.096 sec)
Standby router is local
Priority 100 (default 100)
Group name is "hsrp-Fa0/0-1" (default)
R3#debug standby
HSRP debugging is on
*Mar 1 00:45:36.363: HSRP: Fa0/0 Grp 1 Hello out 10.0.0.3 Standby pri 100 vIP 10.0.0.5
*Mar 1 00:45:36.839: HSRP: Fa0/0 Grp 1 Hello in 10.0.0.2 Active pri 100 vIP 10.0.0.5
R3#
*Mar 1 00:45:39.363: HSRP: Fa0/0 Grp 1 Hello out 10.0.0.3 Standby pri 100 vIP 10.0.0.5
*Mar 1 00:45:39.891: HSRP: Fa0/0 Grp 1 Hello in 10.0.0.2 Active pri 100 vIP 10.0.0.5
*Mar 1 00:45:39.919: HSRP: Fa0/0 Grp 1 Hello in 10.0.0.2 Active pri 100 vIP 10.0.0.5
R3#
*Mar 1 00:45:42.363: HSRP: Fa0/0 Grp 1 Hello out 10.0.0.3 Standby pri 100 vIP 10.0.0.5
*Mar 1 00:45:42.871: HSRP: Fa0/0 Grp 1 Hello in 10.0.0.2 Active pri 100 vIP 10.0.0.5
R3#
*Mar 1 00:45:45.363: HSRP: Fa0/0 Grp 1 Hello out 10.0.0.3 Standby pri 100 vIP 10.0.0.5
*Mar 1 00:45:45.871: HSRP: Fa0/0 Grp 1 Hello in 10.0.0.2 Active pri 100 vIP 10.0.0.5
R3#
*Mar 1 00:45:48.363: HSRP: Fa0/0 Grp 1 Hello out 10.0.0.3 Standby pri 100 vIP 10.0.0.5
*Mar 1 00:45:48.851: HSRP: Fa0/0 Grp 1 Hello in 10.0.0.2 Active pri 100 vIP 10.0.0.5
*Mar 1 00:45:48.899: HSRP: Fa0/0 Grp 1 Hello in 10.0.0.2 Active pri 100 vIP 10.0.0.5
Task 3: Understanding HSRP Failover for Active Routers
Step 1: Shutdown the Active router
R2:
interface f0/0
shutdown
Step 2: Verify HSRP Automatic Gateway selection to Router 3 form Standby state to Active state
R3:
R3#debug standby
HSRP debugging is on
*Mar 1 00:47:28.139: HSRP: Fa0/0 Grp 1 Hello out 10.0.0.3 Active pri 100 vIP 10.0.0.5
*Mar 1 00:47:29.063: HSRP: Fa0/0 Grp 1 Hello out 10.0.0.3 Active pri 100 vIP 10.0.0.5
*Mar 1 00:47:31.139: HSRP: Fa0/0 Grp 1 Hello out 10.0.0.3 Active pri 100 vIP 10.0.0.5
R3#
*Mar 1 00:47:34.139: HSRP: Fa0/0 Grp 1 Hello out 10.0.0.3 Active pri 100 vIP 10.0.0.5
R3#
*Mar 1 00:47:37.139: HSRP: Fa0/0 Grp 1 Hello out 10.0.0.3 Active pri 100 vIP 10.0.0.5
*Mar 1 00:47:37.635: HSRP: Fa0/0 Grp 1 Hello out 10.0.0.3 Active pri 100 vIP 10.0.0.5
R3#
*Mar 1 00:47:40.139: HSRP: Fa0/0 Grp 1 Hello out 10.0.0.3 Active pri 100 vIP 10.0.0.5
R3#
*Mar 1 00:47:43.139: HSRP: Fa0/0 Grp 1 Hello out 10.0.0.3 Active pri 100 vIP 10.0.0.5
R3#sh standby
FastEthernet0/0 - Group 1
State is Active
2 state changes, last state change 00:01:09
Virtual IP address is 10.0.0.5
Active virtual MAC address is 0000.0c07.ac01
Local virtual MAC address is 0000.0c07.ac01 (v1 default)
Hello time 3 sec, hold time 10 sec
Next hello sent in 2.036 secs
Preemption disabled
Active router is local
Standby router is unknown
Priority 100 (default 100)
Group name is "hsrp-Fa0/0-1" (default)
Step 3: Increase the Priority for current Standby Router
R2:
interface f0/0
standby 1 priority 200
exit
R3:
R3#debug standby
HSRP debugging is on
1 00:56:38.655: HSRP: Fa0/0 Grp 1 Hello in 10.0.0.2 Standby pri 200 vIP 10.0.0.5
R3#
*Mar 1 00:56:40.147: HSRP: Fa0/0 Grp 1 Hello out 10.0.0.3 Active pri 100 vIP 10.0.0.5
*Mar 1 00:56:40.991: HSRP: Fa0/0 Grp 1 Hello out 10.0.0.3 Active pri 100 vIP 10.0.0.5
R3#
*Mar 1 00:56:41.671: HSRP: Fa0/0 Grp 1 Hello in 10.0.0.2 Standby pri 200 vIP 10.0.0.5
R3#
*Mar 1 00:56:43.147: HSRP: Fa0/0 Grp 1 Hello out 10.0.0.3 Active pri 100 vIP 10.0.0.5
R3#
*Mar 1 00:56:44.675: HSRP: Fa0/0 Grp 1 Hello in 10.0.0.2 Standby pri 200 vIP 10.0.0.5
Step 4: Preempt to claim status by Router 2
R2:
interface f0/0
standby 1 priority 200
standby 1 preempt
Step 5: Verify HSRP Failover for Router 2 form Standby state to Active state
R3:
R3#debug standby
HSRP debugging is on
*Mar 1 00:59:25.147: HSRP: Fa0/0 Grp 1 Hello out 10.0.0.3 Active pri 100 vIP 10.0.0.5
*Mar 1 00:59:25.215: HSRP: Fa0/0 Interface adv in, Active, active 1, passive 1, from
10.0.0.2
*Mar 1 00:59:25.215: HSRP: Fa0/0 Grp 1 Coup in 10.0.0.2 Standby pri 200 vIP 10.0.0.5
*Mar 1 00:59:25.219: HSRP: Fa0/0 Grp 1 Active: j/Coup rcvd from higher pri router
(200/10.0.0.2)
*Mar 1 00:59:25.219: HSRP: Fa0/0 Grp 1 Active router is 10.0.0.2, was local
Page7
*Mar 1 00:59:25.219: HSRP: Fa0/0 Nbr 10.0.0.2 active for group 1
*Mar 1 00:59:25.219: HSRP: Fa0/0 Grp 1 Standby router is unknown, was 10.0.0.2
*Mar 1 00:59:25.223: HSRP: Fa0/0 Nbr 10.0.0.2 no longer standby for group 1 (Active)
*Mar 1 00:59:25.223: HSRP: Fa0/0 Grp 1 Active -> Speak
*Mar 1 00:59:25.223: %HSRP-5-STATECHANGE: FastEthernet0/0 Grp 1 state Active ->
Speak
*Mar 1 00:59:25.223: HSRP: Fa0/0 Interface adv out, Passive, active 0 passive 1
*Mar 1 00:59:25.227: HSRP: Fa0/0 Grp 1 Redundancy "hsrp-Fa0/0-1" state Active ->
Speak
*Mar 1 00:59:25.231: HSRP: Fa0/0 Grp 1 Deactivating MAC 0000.0c07.ac01
*Mar 1 00:59:25.231: HSRP: Fa0/0 Grp 1 Removing 0000.0c07.ac01 from MAC address
filter
*Mar 1 00:59:25.235: HSRP: Fa0/0 Grp 1 MAC addr update Delete from SMF
0000.0c07.ac01
*Mar 1 00:59:25.235: HSRP: Fa0/0 Grp 1 Hello out 10.0.0.3 Speak pri 100 vIP 10.0.0.5
*Mar 1 00:59:25.239: HSRP: Fa0/0 IP Redundancy "hsrp-Fa0/0-1" update, Active ->
Speak
*Mar 1 00:59:25.247: HSRP: Fa0/0 Interface adv in, Active, active 1, passive 0, from
10.0.0.2
*Mar 1 00:59:25.247: HSRP: Fa0/0 Grp 1 Hello in 10.0.0.2 Active pri 200 vIP 10.0.0.5
R3#
*Mar 1 00:59:28.199: HSRP: Fa0/0 Grp 1 Hello in 10.0.0.2 Active pri 200 vIP 10.0.0.5
*Mar 1 00:59:28.239: HSRP: Fa0/0 Grp 1 Hello out 10.0.0.3 Speak pri 100 vIP 10.0.0.5
*Mar 1 00:59:31.183: HSRP: Fa0/0 Grp 1 Hello in 10.0.0.2 Active pri 200 vIP 10.0.0.5
R3#show standby
FastEthernet0/0 - Group 1
State is Standby
4 state changes, last state change 00:02:00
Virtual IP address is 10.0.0.5
Active virtual MAC address is 0000.0c07.ac01
Local virtual MAC address is 0000.0c07.ac01 (v1 default)
Hello time 3 sec, hold time 10 sec
Next hello sent in 2.560 secs
Preemption disabled
Active router is 10.0.0.2, priority 200 (expires in 8.580 sec)
Standby router is local
Priority 100 (default 100)
Group name is "hsrp-Fa0/0-1" (default)
R2:
R2#show standby
FastEthernet0/0 - Group 1
State is Active
5 state changes, last state change 00:00:41
Virtual IP address is 10.0.0.5
Active virtual MAC address is 0000.0c07.ac01
Local virtual MAC address is 0000.0c07.ac01 (v1 default)
Hello time 3 sec, hold time 10 sec
Next hello sent in 0.100 secs
Preemption enabled
Active router is local
Standby router is 10.0.0.3, priority 100 (expires in 8.204 sec)
Priority 200 (configured 200)
Group name is "hsrp-Fa0/0-1" (default)
R1:
R1#ping 100.100.100.100
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 100.100.100.100, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 76/96/124 ms
Task 4: Verify HSRP Failover using HSRP Tracking
Step 1: Shutdown the serial interface
R2:
interface serial 1/0
shutdown
R2#show standby
FastEthernet0/0 - Group 1
State is Active
5 state changes, last state change 00:09:20
Virtual IP address is 10.0.0.5
Active virtual MAC address is 0000.0c07.ac01
Local virtual MAC address is 0000.0c07.ac01 (v1 default)
Hello time 3 sec, hold time 10 sec
Next hello sent in 0.596 secs
Preemption enabled
Active router is local
Standby router is 10.0.0.3, priority 100 (expires in 8.640 sec)
Priority 200 (configured 200)
Group name is "hsrp-Fa0/0-1" (default)
R3:
R3#debug standby
HSRP debugging is on
*Mar 1 01:07:38.231: HSRP: Fa0/0 Grp 1 Hello out 10.0.0.3 Standby pri 100 vIP 10.0.0.5
R3#
*Mar 1 01:07:40.051: HSRP: Fa0/0 Grp 1 Hello in 10.0.0.2 Active pri 200 vIP 10.0.0.5
*Mar 1 01:07:40.255: HSRP: Fa0/0 Grp 1 Hello in 10.0.0.2 Active pri 200 vIP 10.0.0.5
R3#
*Mar 1 01:07:41.231: HSRP: Fa0/0 Grp 1 Hello out 10.0.0.3 Standby pri 100 vIP 10.0.0.5
R3#
*Mar 1 01:07:43.255: HSRP: Fa0/0 Grp 1 Hello in 10.0.0.2 Active pri 200 vIP 10.0.0.5
*Mar 1 01:07:44.231: HSRP: Fa0/0 Grp 1 Hello out 10.0.0.3 Standby pri 100 vIP 10.0.0.5
R3#
*Mar 1 01:07:46.291: HSRP: Fa0/0 Grp 1 Hello in 10.0.0.2 Active pri 200 vIP 10.0.0.5
*Mar 1 01:07:47.231: HSRP: Fa0/0 Grp 1 Hello out 10.0.0.3 Standby pri 100 vIP 10.0.0.5
R3#
*Mar 1 01:07:49.247: HSRP: Fa0/0 Grp 1 Hello in 10.0.0.2 Active pri 200 vIP 10.0.0.5
*Mar 1 01:07:49.423: HSRP: Fa0/0 Grp 1 Hello in 10.0.0.2 Active pri 200 vIP 10.0.0.5
*Mar 1 01:07:50.231: HSRP: Fa0/0 Grp 1 Hello out 10.0.0.3 Standby pri 100 vIP 10.0.0.5
R3#show standby
FastEthernet0/0 - Group 1
State is Standby
4 state changes, last state change 00:10:16
Virtual IP address is 10.0.0.5
Active virtual MAC address is 0000.0c07.ac01
Local virtual MAC address is 0000.0c07.ac01 (v1 default)
Hello time 3 sec, hold time 10 sec
Next hello sent in 1.272 secs
Preemption disabled
Active router is 10.0.0.2, priority 200 (expires in 7.788 sec)
Standby router is local
Priority 100 (default 100)
Group name is "hsrp-Fa0/0-1" (default)
R1:
R1#ping 100.100.100.100
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 100.100.100.100, timeout is 2 seconds:
UUUUU
Success rate is 0 percent (0/5)
Step 2: Configure HSRP Track to track serial interface
R2:
int f0/0
standby 1 track serial 1/0 150
exit
interface serial 1/0
shutdown
*Mar 1 01:22:49.055: %TRACKING-5-STATE: 1 interface Se1/0 line-protocol Up->Down
*Mar 1 01:22:51.031: %LINK-5-CHANGED: Interface Serial1/0, changed state to
administratively down
*Mar 1 01:22:52.031: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0,
changed state to down
Step 6: Verify HSRP Failover of Router 3 form Standby state to Active state
R3:
R3#debug standby
HSRP debugging is on
R3#
*Mar 1 01:24:21.983: HSRP: Fa0/0 Grp 1 Hello out 10.0.0.3 Active pri 100 vIP 10.0.0.5
*Mar 1 01:24:22.951: HSRP: Fa0/0 Grp 1 Hello in 10.0.0.2 Standby pri 50 vIP 10.0.0.5
R3#
*Mar 1 01:24:23.211: HSRP: Fa0/0 Grp 1 Hello out 10.0.0.3 Active pri 100 vIP 10.0.0.5
R3#
*Mar 1 01:24:24.983: HSRP: Fa0/0 Grp 1 Hello out 10.0.0.3 Active pri 100 vIP 10.0.0.5
*Mar 1 01:24:25.923: HSRP: Fa0/0 Grp 1 Hello in 10.0.0.2 Standby pri 50 vIP 10.0.0.5
R3#
*Mar 1 01:24:27.983: HSRP: Fa0/0 Grp 1 Hello out 10.0.0.3 Active pri 100 vIP 10.0.0.5
R3#
*Mar 1 01:24:28.999: HSRP: Fa0/0 Grp 1 Hello in 10.0.0.2 Standby pri 50 vIP 10.0.0.5
R3#
*Mar 1 01:24:30.983: HSRP: Fa0/0 Grp 1 Hello out 10.0.0.3 Active pri 100 vIP 10.0.0.5
*Mar 1 01:24:31.939: HSRP: Fa0/0 Grp 1 Hello in 10.0.0.2 Standby pri 50 vIP 10.0.0.5
R3#
R3#show standby
FastEthernet0/0 - Group 1
State is Active
5 state changes, last state change 00:01:36
Virtual IP address is 10.0.0.5
Active virtual MAC address is 0000.0c07.ac01
Local virtual MAC address is 0000.0c07.ac01 (v1 default)
Hello time 3 sec, hold time 10 sec
Next hello sent in 2.472 secs
Preemption enabled
Active router is local
Standby router is 10.0.0.2, priority 50 (expires in 7.428 sec)
Priority 100 (default 100)
Group name is "hsrp-Fa0/0-1" (default)
R2:
R2#show standby
FastEthernet0/0 - Group 1
State is Standby
7 state changes, last state change 00:00:58
Virtual IP address is 10.0.0.5
Active virtual MAC address is 0000.0c07.ac01
Local virtual MAC address is 0000.0c07.ac01 (v1 default)
Hello time 3 sec, hold time 10 sec
Next hello sent in 1.384 secs
Preemption enabled
Active router is 10.0.0.3, priority 100 (expires in 7.808 sec)
Standby router is local
Priority 50 (configured 200)
Track interface Serial1/0 state Down decrement 150
Group name is "hsrp-Fa0/0-1" (default)
R1:
R1#ping 100.100.100.100
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 100.100.100.100, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 60/87/108 ms