Configuring HSRP

In this blog post , we will understand the basic configuration of HSRP . I am using Cisco Packet Tracer to do the lab and below is the network diagram which will be used in our lab:

gsrp

In the above Diagram, we will configure the HSRP on R1 and R2 and provide full redundancy for network if any of the router or link fails. We will test the same using loopback IP address 1.1.1.1 configured on the R3. So let us look at the configuration

Note : I am taking only that configuration from the device which is meaningful for this lab.

Router1 Configuration

interface GigabitEthernet0/0
description Connected to Switch
ip address 192.168.1.1 255.255.255.0
duplex auto
speed auto
standby version 2
standby 0 ip 192.168.1.3
standby priority 110
standby preempt
!
interface GigabitEthernet0/1
description Connected to Router3
ip address 172.27.0.1 255.255.255.0
duplex auto
speed auto

ip route 0.0.0.0 0.0.0.0 172.27.0.2
ip route 10.136.200.0 255.255.255.0 192.168.1.4 (Reverse Route)

Router 2 Configuration

interface GigabitEthernet0/0
description Connected to Switch
ip address 192.168.1.2 255.255.255.0
duplex auto
speed auto
standby version 2
standby 0 ip 192.168.1.3
!
interface GigabitEthernet0/1
description Connected to Router 3
ip address 172.27.1.1 255.255.255.0
duplex auto
speed auto

ip route 0.0.0.0 0.0.0.0 172.27.1.2
ip route 10.136.200.0 255.255.255.0 192.168.1.4 (Reverse Route)

Router 3 Configuration

interface Loopback1
ip address 1.1.1.1 255. 255.255.0
!
interface GigabitEthernet0/0
description Connected to Router 1
ip address 172.27.0.2 255.255.255.0
duplex auto
speed auto
!
interface GigabitEthernet0/1
description Connected to Router 2
ip address 172.27.1.2 255.255.255.0
duplex auto
speed auto

Switch Configuration

interface FastEthernet0/1
description Connected to PC
switchport access vlan 200
switchport mode access

interface GigabitEthernet0/1
description “Connected to R1″
switchport access vlan 100
switchport mode access
!
interface GigabitEthernet0/2
description “Connected to R2″
switchport access vlan 100
switchport mode access
!
interface Vlan100
description “Connectivity to Router 1 & Router 2″
ip address 192.168.1.4 255.255.255.0
!
interface Vlan200
description “PC Vlan”
ip address 10.136.200.1 255.255.255.0
!
ip route 0.0.0.0 0.0.0.0 192.168.1.3

Note : Above switch has default route which is pointing to HSRP virtual IP Address configured on R1 and R2. This is the way we achieve HSRP redundancy in network.

PC Configuration 

IP Address : 10.136.200.2/24

Gateway : 10.136.200.1

Verification

Current HSRP details on R1 :

Router1#sh standby brief
P indicates configured to preempt.
|
Interface Grp Pri P State Active Standby Virtual IP
Gig0/0 0 110 P Active local 192.168.1.2 192.168.1.3
Router1#

First Let us see the traceroute output from PC towards 1.1.1.1 IP address:

trace_before

From the above trace , we can see it is going through R1 (192.168.1.1). Now let us shutdown the R1 Link towards Switch.

Router1(config)#interface gigabitEthernet 0/0
Router1(config-if)#shut

Router1(config-if)#
%HSRP-6-STATECHANGE: GigabitEthernet0/0 Grp 0 state Active -> Init

%LINK-5-CHANGED: Interface GigabitEthernet0/0, changed state to administratively down

%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to down

Router1(config-if)#
Router1(config-if)#
Router1(config-if)#^Z
Router1#
%SYS-5-CONFIG_I: Configured from console by console

Router1#
Router1#sh stan
Router1#sh standby bri
Router1#sh standby brief
P indicates configured to preempt.
|
Interface Grp Pri P State Active Standby Virtual IP
Gig0/0 0 110 P Init unknown unknown 192.168.1.3
Router1#

Status of HSRP on R2:

Router2#sh standby brief
P indicates configured to preempt.
|
Interface Grp Pri P State Active Standby Virtual IP
Gig0/0 0 100 Active local unknown 192.168.1.3
Router2#

Now Router2 is active and our traffic to 1.1.1.1 should pass through it. Let us see the output of traceroute on PC:

trace_after

Note:  The traffic in the above trace moved though R2 automatically using HSRP without any manual Configuration.