Previous section   Next section

Recipe 22.6 Manipulating HSRP Timers

22.6.1 Problem

You want to decrease the amount of time it takes for the backup router to take over after the primary router fails.

22.6.2 Solution

You can configure HSRP-enabled routers to recover more quickly after the primary HRSP router becomes unavailable with the standby timers configuration command:

Router1#configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z.
Router1(config)#interface FastEthernet0/1
Router1(config-if)#standby 1 ip 172.22.1.1
Router1(config-if)#standby 1 priority 120
Router1(config-if)#standby 1 preempt
Router1(config-if)#standby 1 timers 1 3 
Router1(config-if)#end
Router1#

If you change the HSRP timers on one router, you must change the timers on all of the other routers in the same group:

Router2#configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z.
Router2(config)#interface FastEthernet1/0
Router2(config-if)#standby 1 ip 172.22.1.1
Router2(config-if)#standby 1 priority 110
Router2(config-if)#standby 1 preempt
Router2(config-if)#standby 1 timers 1 3
Router2(config-if)#end
Router2#

22.6.3 Discussion

By default, a router will send HSRP hello packets every 3 seconds, and a standby router will declare itself active if it doesn't hear any hello packets from the active router for 10 seconds. The command in the example changes the timers from these default values to a 1-second hello period and 3-second failover:

Router1(config-if)#standby 1 timers 1 3

With this command, the standby router can reduce the amount of outage time by 7 seconds. This might be useful in some highly mission-critical networks.

The show standby command output includes the timer settings so you can easily see what values the router is using:

Router1#show standby
FastEthernet0/1 - Group 1
  Local state is Active, priority 120, may preempt
  Hellotime 1 sec, holdtime 3 sec
  Next hello sent in 0.420
  Virtual IP address is 172.22.1.1 configured
  Active router is local
  Standby router is 172.22.1.2 expires in 2.968
  Virtual mac address is 0000.0c07.ac01
  5 state changes, last state change 12:50:25
Router1#

Decreasing the HSRP hello interval also increases the amount of background chatter on the network segment. But, since HSRP routers exchange these packets using IP multicast, it is relatively efficient. Even if there are many routers in the same group, each packet only appears on the network once. And, unlike broadcasts, these packets shouldn't cause problems for other devices on the segment. It is unlikely that anybody would want to increase these timers from their default values.

If you need the timers to be even faster, you can configure millisecond intervals:

Router1(config-if)#standby 1 timers msec 100 msec 300

With the msec keyword, Cisco routers will accept a range of 50 to 999 milliseconds for the hello interval and 200 to 3000 milliseconds for the hold timer. Without this keyword, the hello interval must be between 1 and 254 seconds, and the hold timer must be between 2 and 255 seconds.

Be extremely careful with these millisecond timings! They can cause two potential problems. If the timers are too short (for example, if you set the hello timer to 50 milliseconds on a busy 4Mbps Token Ring) you could cause congestion problems on the ring. The second problem to watch out for is using a timer that is too short for the network to reliably deliver. For example, if your LAN includes any bridges (including ATM LAN extensions) to remote sites, you may get spurious transitions just caused by random variation in latencies (jitter).

The HSRP RFC states that the hold time should be at least three times the value of the hello time and MUST be greater then the hello time. Setting your hold time to three times the hello time is a good rule of thumb. This allows the router to miss two packets due to congestion or random noise without disrupting the way the network functions.

22.6.4 See Also

RFC 2281


  Previous section   Next section
Top