Wednesday, December 31, 2008, 01:51 PM -
CiscoPosted by Administrator
HSRP(Hot Standby Routing Protocol) is mainly used in networks for keeping the redundant gateways.Its a Cisco Proprietary protocol.In this article we will discuss implementation of HSRP in a network.We have used GNS for the simulation.The router used was c3600 and the IOS image is c3640-jk9s-mz.124-16.bin.

Here in the diagram we have taken 2 Distribution layer switches (DS1, DS2)and 2 Access layer switches(AS1, AS2).
We have taken 2 routers and will use them as PC's(PC1, PC2).
We will use the routers as switches and pc's.
On routers (DS1,DS2,AS1,AS2)we have inserted NM16-ESW card in the slot and on routers(PC1,PC2) we have inserted NM-1E card.
The connections are as follows
DS1-->DS2 = F0/0--F0/0
DS2-->AS2 = F0/1--F0/0
DS1-->AS1 = F0/1--F0/0
DS2-->AS1 = F0/2--F0/1
DS1-->AS2 = F0/2--F0/1
AS2-->PC2 = F0/2--E0/0
AS1-->PC1 = F0/2--E0/0
First we have to create vlans by giving vlan database command
----------------------------------------------------------
DS1#vlan database
DS1(vlan)#vlan 10
VLAN 10 added:
Name: VLAN0010
DS1(vlan)#vlan 20
VLAN 20 added:
Name: VLAN0020
DS1(vlan)#vlan 30
VLAN 30 added:
Name: VLAN0030
DS1(vlan)#no vlan 2
Deleting VLAN 2...
DS1(vlan)#exit
DS1(vlan)#exit
APPLY completed.
Exiting....
DS1#------------------------------------------------------------
We have to also define the VTP properties like VTP domain and VTP modes on the 2 Distribution switches.We will give following commands for the same.
------------------------------------------------------------
DS1(vlan)#vtp domain test
Changing VTP domain name from NULL to test
DS1(vlan)#vtp server
Device mode already VTP SERVER.
DS1(vlan)#vtp v2-mode
V2 mode enabled.
DS1(vlan)#exit
APPLY completed.
Exiting....
DS1#
-------------------------------------------------------------
We have to give exit command after making the necessary changes to apply them on the router otherwise the configuration will not be saved.
On DS2 we will configure the VTP Domain as test and mode as client
--------------------------------------------------------------
DS2#vlan database
DS2(vlan)#vtp Domain test
Changing VTP domain name from NULL to test
DS2(vlan)#vtp v2-mode
V2 mode enabled.
DS2(vlan)#vtp client
Setting device to VTP CLIENT mode.
DS2(vlan)#exit
In CLIENT state, no apply attempted.
Exiting....
DS2#
--------------------------------------------------------------
Then we have to make the interface fast 0/0 as a trunk interface
--------------------------------------------------------------
DS1(config)#int fast 0/0
DS1(config-if)#switchport mode trunk
DS1(config-if)#switchport
*Mar 1 00:11:22.043: %DTP-5-TRUNKPORTON: Port Fa0/0 has become dot1q trunk
*Mar 1 00:11:22.547: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, c
anged state to up
*Mar 1 00:11:22.559: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, c
anged state to up
*Mar 1 00:11:22.571: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan30, c
anged state to uptr
DS1(config-if)#switchport trunk allowed vlan add 10,20,30
DS2(config)#int fastEthernet 0/0
DS2(config-if)#switchport mode trunk
*Mar 1 00:12:40.991: %DTP-5-TRUNKPORTON: Port Fa0/0 has become dot1q trunk
DS2(config-if)#switchport trunk allowed vlan add 10,20,30
--------------------------------------------------------------------------------
Here, we can see that the trunk port has been set and is propagating VLAN information
We will confirm the vlans created on both the switches by giving below command
--------------------------------------------------------------------------
DS1#sh vlan-switch
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/0, Fa0/1, Fa0/2, Fa0/3
Fa0/4, Fa0/5, Fa0/6, Fa0/7
Fa0/8, Fa0/9, Fa0/10, Fa0/11
Fa0/12, Fa0/13, Fa0/14, Fa0/15
10 VLAN0010 active
20 VLAN0020 active
30 VLAN0030 active
1002 fddi-default active
1003 trcrf-default active
1004 fddinet-default active
1005 trbrf-default active
-----------------output omitted----------------------------------------------
DS2#sh vlan-switch
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4
Fa0/5, Fa0/6, Fa0/7, Fa0/8
Fa0/9, Fa0/10, Fa0/11, Fa0/12
Fa0/13, Fa0/14, Fa0/15
10 VLAN0010 active
20 VLAN0020 active
30 VLAN0030 active
1002 fddi-default active
1003 trcrf-default active
1004 fddinet-default active
1005 trbrf-default active
----------------output omitted-------------------------------------------------
-----------------------------------------------------------------------------
Then, we have to start configuring the VLAN interface
-------------------------------------------------------------------
DS1#configure terminal
Enter configuration commands, one per line. End with CNTL
DS1(config)#int vlan 10
DS1(config-if)#ip address 192.168.10.252 255.255.255.0
DS1(config-if)#no shutdown
DS1(config-if)#int vlan 20
DS1(config-if)#ip address 192.168.20.252 255.255.255.0
DS1(config-if)#no shut
DS1(config-if)#int vlan 30
DS1(config-if)#ip address 192.168.30.252 255.255.255.0
DS1(config-if)#no shut
DS2(config)#int vlan 10
DS2(config-if)#ip address 192.168.10.253 255.255.255.0
*Mar 1 00:15:51.011: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, ch
anged state to up
DS2(config-if)#no shut
DS2(config-if)#int vlan 20
DS2(config-if)#ip address 192.168.20.253 255.255.255.0
*Mar 1 00:16:17.335: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, ch
anged state to up
DS2(config-if)#no shut
DS2(config-if)#int vlan 30
DS2(config-if)#ip address 192.168.30.253 255.255.255.0
*Mar 1 00:16:34.835: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan30, ch
anged state to up
DS2(config-if)#no shut
DS2(config-if)#
--------------------------------------------------------------------------------------
After completing this basic config we can start configuration of HSRP by giving following commands.
--------------------------------------------------------------------------------
DS1(config)#int vlan 10
DS1(config-if)#standby 100 ip 192.168.10.254
DS1(config-if)#standby 100 priority 110
*Mar 1 00:23:00.071: %HSRP-5-STATECHANGE: Vlan10 Grp 100 state Speak -> Standby
*Mar 1 00:23:00.571: %HSRP-5-STATECHANGE: Vlan10 Grp 100 state Standby -> Active
DS1(config-if)#int vlan 20
DS1(config-if)#standby 100 ip 192.168.20.254
DS1(config-if)#standby 100 priority 110
*Mar 1 00:23:22.835: %HSRP-5-STATECHANGE: Vlan20 Grp 100 state Speak -> Standby
*Mar 1 00:23:23.335: %HSRP-5-STATECHANGE: Vlan20 Grp 100 state Standby -> Active
DS1(config-if)#int vlan 30
DS1(config-if)#standby 100 ip 192.168.30.254
DS1(config-if)#standby 100 priority 110
DS1(config-if)#
*Mar 1 00:24:03.455: %HSRP-5-STATECHANGE: Vlan30 Grp 100 state Speak -> Standby
*Mar 1 00:24:03.955: %HSRP-5-STATECHANGE: Vlan30 Grp 100 state Standby -> Active
DS2(config-if)#int vlan 10
DS2(config-if)#standby 100 ip 192.168.10.254
*Mar 1 00:25:45.991: %HSRP-5-STATECHANGE: Vlan10 Grp 100 state Speak -> Standby
DS2(config-if)#int vlan 20
DS2(config-if)#standby ip 192.168.20.254
*Mar 1 00:26:21.543: %HSRP-5-STATECHANGE: Vlan20 Grp 0 state Speak -> Standby
DS2(config)#int vlan 30
DS2(config-if)#standby 100 ip 192.168.30.254
*Mar 1 00:26:41.531: %HSRP-5-STATECHANGE: Vlan30 Grp 100 state Speak -> Standby
----------------------------------------------------------------------------
We could have done this configuration in the earlier section also but made it here for the simplicity.
We have configured the group 100 for the HSRP and given the addresses as x.x.x.254 which will serve as a virtual IP for the gateway.
Here,we can see that the states for the respective groups are getting shifted from Speak to Standby and then from Standby to Active on DS1 switch.And on DS2 group remains in standby state as we have configured the priority 110 on the DS1 switch which is above 100(default for HSRP).When the DS2 sees that there is higher priority available then it throws the role of being Active.
If the DS1 will get rebooted or shutdown then the Active role will get shifted to DS2.
Now we will move further and make configurations for Access layer switches AS1 and AS2.
We will make interfaces of these switches as Trunk interfaces.
---------------------------------------------------------------------------------
DS1(config)#int fast 0/2
DS1(config-if)#sw mode trunk
*Mar 1 00:03:04.347: %DTP-5-TRUNKPORTON: Port Fa0/2 has become dot1q trunkall
DS1(config-if)#sw trunk allowed vlan add 10,20,30
DS1(config-if)#int fast 0/1
DS1(config-if)#sw mode trunk
*Mar 1 00:11:37.119: %DTP-5-TRUNKPORTON: Port Fa0/1 has become dot1q trunk
DS1(config-if)#sw trunk allowed vlan add 10,20,30
DS2(config)#int fast 0/2
DS2(config-if)#sw mode trunk
*Mar 1 00:03:25.231: %DTP-5-TRUNKPORTON: Port Fa0/2 has become dot1q trunk
DS2(config-if)#sw trunk allowed vlan add 10,20,30
DS2(config)#int fast 0/1
DS2(config-if)#sw mode trunk
*Mar 1 00:16:26.003: %DTP-5-TRUNKPORTON: Port Fa0/1 has become dot1q trunk
DS2(config-if)#switchport trunk allowed vlan add 10,20,30
AS2(config)#int fast 0/0
AS2(config-if)#switchport mode trunk
*Mar 1 00:08:07.951: %DTP-5-TRUNKPORTON: Port Fa0/0 has become dot1q trunk
AS2(config-if)#switchport trunk allowed vlan add 10,20,30
AS2(config-if)#int fast 0/1
AS2(config-if)#switchport mode trunk
*Mar 1 00:08:35.931: %DTP-5-TRUNKPORTON: Port Fa0/1 has become dot1q trunktru
AS2(config-if)#switchport trunk allowed vlan add 10,20,30
AS1(config)#int fast 0/1
AS1(config-if)#switchport mode trunk
*Mar 1 00:09:27.935: %DTP-5-TRUNKPORTON: Port Fa0/1 has become dot1q trunktru
AS1(config-if)#switchport trunk allowed vlan add 10,20,30
AS1(config-if)#int fast 0/0
AS1(config-if)#switchport mode trunk
*Mar 1 00:10:13.967: %DTP-5-TRUNKPORTON: Port Fa0/0 has become dot1q trunkallo
AS1(config-if)#switchport trunk allowed vlan add 10,20,30
---------------------------------------------------------------------
We have to configure the VTP parameters on these switches also.
---------------------------------------------------------------
AS1#vlan database
AS1(vlan)#vtp domain test
Changing VTP domain name from NULL to test
AS1(vlan)#vtp v2-mode
V2 mode enabled.
AS1(vlan)#vtp client
Setting device to VTP CLIENT mode.
AS1(vlan)#exit
In CLIENT state, no apply attempted.
Exiting....
AS1#
AS2#vlan database
AS2(vlan)#vtp domain test
Changing VTP domain name from NULL to test
AS2(vlan)#vtp v2-mode
V2 mode enabled.
AS2(vlan)#vtp client
Setting device to VTP CLIENT mode.
AS2(vlan)#exit
In CLIENT state, no apply attempted.
Exiting....
AS2#
------------------------------------------------------------------
Now we will make the ports attached to PC1 and PC2 as switched ports.
------------------------------------------------------------------
AS2(config)#int fast 0/2
AS2(config-if)#sw mode access
AS2(config-if)#sw access vlan 10
AS1(config)#int fast 0/2
AS1(config-if)#sw mode access
AS1(config-if)#sw access vlan 20
-------------------------------------------------------------------
Now we will configure the IP address to PC1 and PC2 by giving below commands
----------------------------------------------------------------------
PC2(config)#int ethernet 0/0
PC2(config-if)#ip address 192.168.10.100 255.255.255.0
PC2(config-if)#no shut
PC1(config)#int ethernet 0/0
PC1(config-if)#ip address 192.168.20.100 255.255.255.0
PC1(config-if)#no shut
---------------------------------------------------------------------
Now if we check by pinging the gateway then it will do it but not to other machines in the network.
PC2#ping 192.168.10.254
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.10.254, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/64/144 ms
PC2#ping 192.168.20.254
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.20.254, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
PC2#
---------------------------------------------------------------------
PC1#ping 192.168.20.254
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.20.254, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/53/100 ms
PC1#ping 192.168.10.254
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.10.254, timeout is 2 seconds:
PC1#ping 192.168.10.254
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.10.254, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
PC1#
------------------------------------------------------------------------
It will able to ping to its gateway and for that we need to configure the default gateway on the PC! and PC2 as below.
----------------------------------------------------------------------
PC2(config)#ip route 0.0.0.0 0.0.0.0 192.168.10.254
PC2(config)#exit
PC1(config)#ip route 0.0.0.0 0.0.0.0 192.168.20.254
PC1(config)#exit
---------------------------------------------------------------------
PC2#ping 192.168.20.254
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.20.254, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 28/53/144 ms
PC2#ping 192.168.10.254
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.10.254, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 12/72/132 ms
PC2#
-----------------------------------------------------------------------
PC1#ping 192.168.10.254
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.10.254, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/74/192 ms
PC1#ping 192.168.20.254
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.20.254, timeout is 2 seconds:
!!!.!
Success rate is 80 percent (4/5), round-trip min/avg/max = 44/134/192 ms
PC1#
Here completes the HSRP configuration.There are many options which we can configure in HSRP like preempt, Interface tracking etc.I will try to cover it in next parts.
Other categories
Cisco Jokes Photos Tutorials Voip Goa