Previous section   Next section

Recipe 22.3 Making HSRP React to Problems on Other Interfaces

22.3.1 Problem

You want HSRP to switch to the backup router when another port on the primary router becomes unavailable.

22.3.2 Solution

The standby track configuration command reduces the priority of an active HSRP router into a standby mode when one of its interfaces becomes unavailable. If the priority drops far enough, another router will take over:

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 track Serial0/0 20
Router1(config-if)#end
Router1#

22.3.3 Discussion

This configuration option is particularly useful when you have two identically configured WAN access routers using HSRP on their LAN ports. In this case, if you are using a dynamic routing protocol, then losing the WAN connection to one of the routers isn't actually a disaster. The routing protocol will tell the active router to forward all of its outbound traffic to the standby router, which will still have a good connection. However, this is obviously inefficient. It would be better if the active router simply resigned its active status and let the standby router take over.

HSRP does this by decreasing the priority for the active router. It decreases the priority by 10 points by default, but you can configure this amount. In the example, the router drops its HSRP priority by 20 points when the interface Serial0/0 becomes unavailable:

Router1(config-if)#standby 1 track Serial0/0 20

In all of our examples so far, we have configured the priorities of the two HSRP routers to have a difference of 10 priority points. If we used the default priority drop in this standby track command, a failure of the tracked interface would give the two routers equal priority. The router with the higher IP address will then become the active router when this interface fails, but this might not be the right choice. We have specified a value of 20 priority points in this command to ensure that the other router will take over appropriately.

You can use the standby track command to track any router interface, or even multiple interfaces. To track several interfaces, you just specify all of the interfaces in separate standby track commands:

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 track Serial0/0 20
Router1(config-if)#standby 1 track Serial0/1 20
Router1(config-if)#end
Router1#

In this example, we have explicitly configured HSRP to decrement the priority by 20 if either of the tracked interfaces fails. So, if both interfaces fail, the priority will drop by 40 points.

For the standby track command to work properly, you must also configure standby preempt, as described in Recipe 22.2. This is because you want to allow the router that now has the higher priority (after the tracked interface failure) to send an HSRP coup message and take control.

When you use tracking like this, the show standby command includes information about the interface that is being tracked, as well as what will happen to the priority when that interface goes down:

Router1#show standby 
FastEthernet0/1 - Group 1
  Local state is Active, priority 120, may preempt
  Hellotime 3 sec, holdtime 10 sec
  Next hello sent in 0.564
  Virtual IP address is 172.22.1.1 configured
  Active router is local
  Standby router is 172.22.1.2 expires in 9.848
  Virtual mac address is 0000.0c07.ac01
  5 state changes, last state change 12:47:08
  Priority tracking 1 interface, 1 up:
    Interface                  Decrement  State
    Serial0/0                     20      Up   
Router1#

When this interface goes down, causing an HSRP priority change, the router will send several messages to the log buffer:

Jun 24 23:24:58: %STANDBY-6-STATECHANGE: FastEthernet0/1 Group 1 state Active -> Speak
Jun 24 23:25:00: %LINK-3-UPDOWN: Interface Serial0/0, changed state to down
Jun 24 23:25:01: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed 
state to down

The HSRP change happens so quickly that the message actually precedes the serial interface change. This is because the serial interface doesn't send its message immediately when it loses control signals, but the HSRP change does react immediately. Upon repairing the serial interface problem, the router will send several more messages to the log:

Jun 24 23:25:07: %STANDBY-6-STATECHANGE: FastEthernet0/1 Group 1 state Standby -> 
Active
Jun 24 23:25:08: %LINK-3-UPDOWN: Interface Serial0/0, changed state to up
Jun 24 23:25:09: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed 
state to up

Again, the serial interface takes a few seconds to react, but the HSRP change is immediate. This underscores the need for the preempt delay command discussed in Recipe 22.2.

The standby track command has one other interesting application on routers that run IOS level 12.2(8)T and higher. In these versions, you can use the keepalive command with GRE tunnels, as discussed in Chapter 12. With this option, GRE tunnels will mimic the behavior of physical interfaces and go into a down state if the far end of the tunnel becomes unavailable. This means that you can use standby track on a tunnel interface, which in turn means that you can now make your HSRP priority change in response to problems elsewhere in the network.

There were two important bugs with HSRP interface tracking prior to IOS level 12.1. The first happens when you track multiple interfaces. If you do not explicitly configure the priority decrement, the router will only drop the priority by a total of 10 points, no matter how many tracked interfaces fail. The second is that if the tracked interface is down at boot time and remains down, HSRP treats it as if it were up. Both of these bugs were fixed in IOS level 12.1.

22.3.4 See Also

Recipe 22.2; Chapter 12


  Previous section   Next section
Top