Manipulating HSRP Timers

Problem

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

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)#exit
Router1(config)#end
Router1#

If you change the HSRP timers on one router, then 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)#exit
Router2(config)#end
Router2#

 

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 one-second Hello period and three-second failover:

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

With this command, the standby router can reduce the amount of outage time by seven 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. So it is unlikely that anybody would want to increase these timers from their default values.

If you need the timers to be faster still, 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 15 to 999 msec for the Hello interval, and 50 to 3,000 for the hold timer. Without this keyword, the hello interval must be between 1 and 254 seconds, and the hold timer between 2 and 255 seconds.

We caution the reader to 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 15 milliseconds on a busy 4 Mbps 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.

Router Configuration and File Management

Router Management

User Access and Privilege Levels

TACACS+

IP Routing

RIP

EIGRP

OSPF

BGP

Frame Relay

Handling Queuing and Congestion

Tunnels and VPNs

Dial Backup

NTP and Time

DLSw

Router Interfaces and Media

Simple Network Management Protocol

Logging

Access-Lists

DHCP

NAT

First Hop Redundancy Protocols

IP Multicast

IP Mobility

IPv6

MPLS

Security

Appendix 1. External Software Packages

Appendix 2. IP Precedence, TOS, and DSCP Classifications

Index



Cisco IOS Cookbook
Cisco IOS Cookbook (Cookbooks (OReilly))
ISBN: 0596527225
EAN: 2147483647
Year: 2004
Pages: 505

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net