April 7, 2010

HSRP Interface Tracking

HSRP stands for “Hot Standby Router Protocol”

RCF 2281 defines in detail HSRP - http://tools.ietf.org/html/rfc2281

The purpose of this post isn’t to dive into the details of HSRP but simply to shed light on an HSRP feature often overlook when setting redundant routers for redundant ethernet path.

HSRP Election

When powering up routers running HSRP, the routers (by default in group 0) starts sending to each other (multicast: 224.0.0.2) hello packets to determine who else is part of the HSRP group. Past that, the routers start an election process based on the router’s set HSRP priority.

The HSRP priority is set by using the command “standby priority

interface fa0/0 standby priority 80

Keep in mind that the default priority is “100”… that is to say if no “standby priority” command is issue on this interface, this interface would have a priority of 100.

Once the routers elect the active router based on who has the higher priority, the other members of the HSRP group become “passive” routers or in Cisco terms “standby routers”.

What happens if all routers do not have a custom priority set or have the same priority?

If all routers have the same priority, then the router who has the “highest” IP address is elected the active router

A Typical HSRP Setup

As you can guess … the red path references the active router and the path through which the hosts on the LAN would be routed. Now keeping in mind that HSRP is running interface fa0/0 of both routers and that the link on s0/0 from the active router to the ISP would fail (see 2nd figure)

Since the serial link on the active router would fail, traffic would be redirected from the active router to the passive router on the secondary Ethernet interface… so in a nutshell, the active router still remains the active route (fa0/0 never fails) but the computers of the LANs have one more hop to go through to connect to the ISP.

The new path is show in “blue”

While this is not a technical issue in itself, it is possible to have the Virtual IP Address failover to the passive router by “monitoring” the state of the serial interface “s0/0” and not only the state of fa0/0.

As we said earlier, the process of electing the active router in an HSRP group is to first evaluate the HSRP interface priority and then in case of a tie the highest IP address.

The command to enable interface tracking is

standby track INTERFACE PRIORITY_DECREMENT

So a typical configuration on both routers would look as follow

Active Router int fa0/0 ip address 192.168.1.100 255.255.255.0 standby ip 192.168.1.1 standby track S0/0 30

Passive Router

int fa0/0 ip address 192.168.1.101 255.255.255.0 standby ip 192.168.1.1 standby priority 90 standby track S0/0 30

On both router’s fa0/0 we have setup “interface tracking” on serial 0/0 with a priority decremental value of 30 - that is to say if s0/0 on the active was to go down, the HSRP priority of fa0/0 would be of (100 - 30) so 70… since the HSRP priority of the passive router is 90, the VIP will then failover to the passive router which will become the active router.

Traffic will then be routed directly through the second router without having to be re-routed through the first router as seen in the 3rd figure.