HSRP stands for Hot Standy Routing Protocol which provides Automatic Router backup when an active router in the group fails. HSRP allows building resiliency in the network gateways wherein should an Active Router fail in a HSRP group, the standby router assumes the role of the active router and continue routing packets.
HSRP works by sending multicast "Hello" messages (default: every 3 secs). If the Standby router do not receive any Hello packets from the active router for a preset time (default 10secs) then it assumes the active router is down and becomes the active router. Also, if we are tracking an interface and if the tracked interface is down, the Active Router reduces its priority so a Standby Router can assume to role of Primary Router.
A realtime example would be access to a service providers servers at a remote location. Lets say there are two distinct routes to the same server(s), each through individual routers. The clients on the internal network segment are configured to send the traffic through a gateway. The gateway being the HSRP Address. Then the Server is accessible through one service provider always (based on the active router). However, in a disaster situation when the active router goes down, the standby router assumes the active router role and continues to serve connection to the remote servers but using the other service provider. This way routing redundancy is provided to a remote resource.
To setup HSRP on a pair of routers,
Router 1:
From the Interface Configuration Mode add the IP Address of the Interface
hsrp-router1#conf t
hsrp-router1(config)# int fa0/0
hsrp-router1(config-if)# ip address 192.168.0.2 255.255.255.0
Set the Virtual IP Address
Sets the Virtual IP Address for the interface where "1" is the HSRP group and "92.168.0.1" is the Virtual IP for the HSRP group.
hsrp-router1(config-if)# standby 1 ip 192.168.0.1
Enable Preempt
This is required to make the router from being a Standby Router to an Active Router when it finds the Active Router is down or if it has become the higher priority router in the group
hsrp-router1(config-if)# standby 1 preempt
Set Router Priority
The default priority is "100". We set here as "110" to make the Router 1 as active.
hsrp-router1(config-if)# standby 1 priority 110
Set Authentication String
This is an optional plain text 8 character string that can be used in the multicast "hello" packets to authenticate the HSRP group.
hsrp-router1(config-if)# standby 1 authentication LocalLAN
Set Timers
Sets the time period between the "hello" packets and the hold time before assuming an active router is down. Default is 3seconds and 10 seconds respectively.
hsrp-router1(config-if)# standby 1 timers 5 15
Track Interface
If you track interface to check link status then the following command will track an interface and when the tracked link is down, the active router will mark its priority low so as to allow a Standby router to take over.
hsrp-router1(config-if)# standby 1 track se0/0
Repeat the procedure altering the IP Address of the Local interface and the priority and the tracked interface.
Router 2:
hsrp-router2#conf t
hsrp-router2(config)# int fa0/0
hsrp-router2(config-if)# ip address 192.168.0.3 255.255.255.0
hsrp-router2(config-if)# standby 1 ip 192.168.0.1
hsrp-router2(config-if)# standby 1 preempt
hsrp-router2(config-if)# standby 1 priority 100
hsrp-router2(config-if)# standby 1 authentication LocalLAN
hsrp-router2(config-if)# standby 1 timers 5 15
hsrp-router2(config-if)# standby 1 track se0/0
Thats it. HSRP configuration is complete. You may test the connectivity to a remote route and see for yourself the redudancy in place.
I have checked this config it works fine, But i dont understand the user of track command. As without the track command the goal is achieved.
If really the track command is required than pls revert with explanation on my mail address.
Thanks for the information.
The tracker can help when the tracked interface go down to trigger an HSRP failover. Ideal in instances where you have multiple external interfaces connecting to an external network. here while u HSRP the FA interfaces, u r triggering a failover should ur primary serial interface goes down
Hi
please give me a example for ip track
The Hot Standby Router Protocol (HSRP) is a Cisco proprietary first-hop redundancy protocol (FHRP) designed to allow for transparent fail-over of the first-hop IP router, and has been described in detail in RFC 2281.
http://www.ciscozine.com/2008/10/29/implementing-high-availability-with-hsrp/
For srinivas:
an example of tracking interface is present on http://www.ciscozine.com/2008/11/01/how-to-optimize-hsrp/
thank u for ur detail example of hsrp.
Hi,
Fantastic explaination of HSRP, I didn’t understand in my lecture or even in notes but I got it here.
Many Thanks
this configuration fails in case you are having ethernet link because ethernet port never goes down whenever you link is down due to lastmile problem. So traffic will never shift to standby router. To avoid this we can use track default route command. So what ever the type of link (Serial, ethernet) you are using, traffic will shift to standby router.
track 0.0.0.0 0.0.0.0
What is the track default route command? what if my default route is on the LAN interface and not on the WAN/SERIAL/ETHERNET port as described here?
I have implemented HSRP and it works great!! I have tested it and when the active router goes down, the standby kicks in with no problems. But I noticed that when the standby router goes down, how come all data stops? Has anyone else encountered this problem and if so, is this issue a configuration mishap?
How does the hold timer work? In case the active router1 has been reset successfully, will it return to be the active one? If yes, how long will this revertive time take?
Does it work similar in case of active router1 port down/up?
Thanks!
Hi, I tried the steps and got stuck at configuring ip address on my LAN interface fa 0/1/0. The router gave me an error message “IP address may not be configured on L2 links”. What do I do? Please help.
configure gig0/1/0 it will accept IP.
all the best.
Hi Folks
I have the below scenario.
A.I have two routers at remote office forming tunnels to two routers at head office.(remote1 to HO1 and remote2 to HO2 respectively).
B.Remote 1 router forms GRE tunnels and remote 2 router forms IPsec tunnel.
If I configure HSRP between them and track tunnel interface on remote 1(which I want to be primary) will it work smooth?
Awaiting replies.
hey ottawa, please make sure fa0/1/0 doesn’t have “switchport” command. IP is considered as layer 3 and switchport is L2.
question: preempt is used for the router to be “active” should the active router goes down. If this is disabled, what will be the point of considering HSRP? no tracking also enabled. Also, the other comment is for Otakoya, apologies, mispelled your name. thanks for all ur reply.
very helpful and easily understandable article.IF u provide its PDF version,it would be very helpful for future reference.
Very much thanks to every one and also to the admin…i understood HSPR really very well by refering to this site and also to all those comments… Thanks to all of you 🙂
Does anyone know the command to show all HSRP groups that are currently active? I am currently running the show standby vlan xxx but would rather be able to view all active in one shot.
Thanks
Thank you for your detail example of hsrp Information.
I have to connect two locations from my location with two ISP’z links (Total 4 links,ISP-1 Primary,Secondary same way ISP-2 Primary,Secondary).
How do I configure HSRP with this for two locations?
Can some one help me on this?
thanks a lot for the previous command and the illustration of each command . really it seemed very useful to me and helped me to understand the protocol and its corresponding commands
Brent, You can issue the “show stand brief” command to show the status of all HSRP groups.
Also, best practice is to use priorities that are only 5 numbers apart. For example I would use a priority of 110 on router 1 and a priority of 105 on router 2. The reason is that by default the priority decreases by 10 so router 1’s priority would now be 100 which is lower than router 2’s priority of 105. In the example above both if s0/0 went down then router 1’s priority would decrease by 10 to 100 which would be the same as router 2. You can however change the default amount that the priority is lowered by.
Thanks guys, you are doing a great work.
Jerald,
I agree with your best practice of using priorities ending in “5”. Allow me to clarify why the example given still works regardless.
Should the s0/0 go down off Router1 the priority would drop to 100. This is EQUAL to Router2 (priority 100 as well). Why then does Router2 take over? Router2 has a higher IP address; the tie breaker when priorities are equal. So Router2 192.168.0.3 wins over Router1 192.168.0.2 given both priorities are now 100. Sure this works but I prefer a definitive use of the priority command for Router 1: standby 1 priority 105
dear all, im not able to run standby command i donn know why, im running packet tracer (router is PT router) and the output is as follows:
Router(config)#int fa0/0
Router(config-if)#ip address 172.16.1.1 255.255.255.0
Router(config-if)#standby 10 ip 172.16.1.3
^
% Invalid input detected at ‘^’ marker.
HI Iqbal.
Check your IOS on the router. Make sure that it supports HSRP. Usually when a router/swich gives you the error you are experiencing its becuase the command is not supported.
Good luck.
hi,
i configured the hsrp in my testbed.
now i want to write a script based on that configuration ,
so,please help me to write those scriptsplease let me know.
thanks,
meena
Hi all,
I will setup a network with two routers (HQ1) and (Remote site1) using 2 leased line connected to GE1 & GE2 on both sides. Can I use the HSRP config as my config redundancy?
For example, when my primary link is been suddenly down, then the secondary line will be fire-up.
Any idea on this setup? Any solutions is much appreciated.