Hot Standby Routing Protocol (HSRP)

Posted by – September 2, 2008

Let say you have a gateway which allows you to access internet. This gateway goes down 🙁
All you need is … redundancy ! Hot Standby Routing Protocol is here to help you.
This article will show you a configuration example to make it work.

Topology

Lets explain the basic configuration of the routers.

R1

R2

Nothing difficult to understand. You can see that there will be a static route for the internet traffic on both R1 and R2.

Now let’s configure R3 and R4. In my lab both R3 and R4 on their f0/1 interfaces will get IP addresses from the DHCP server on my LAN (which will also provide internet connection).
NAT with overload (PAT) will also be configured on both R3 and R4 for the internet connectivity on PC1

R3

R4

Don’t forget the route for the LAN network (192.168.0.0)
Now all is set.

If we want to configure PC1, we can set for example:
IP ADDRESS> 192.168.0.60
NETMASK> 255.255.255.0
GATEWAY> 192.168.0.2 or 192.168.0.3
DNS SERVER> 10.19.40.1 //this is my LAN DNS server.

Sweet it’s working, now we can configure our redundancy. The principle here is simple, we will assign a virtual IP address on both R1 and R2. And this virutal IP address will be the gateway for PC1
R1

R2

Explanations:
standby 1 ip 192.168.0.1
The number 1 is the hsrp group. The IP address 192.168.0.1 will be the virtual one, this will be PC1’s gateway.

standby 1 preempt
This is needed for the router to become the Active Router instead of the Standby Router. When it sees that the Active router is down or when its priority has becomed higher thant the Active router’s one.

standby 1 priority 100
that’s the priority, if we have 2 routers, the one with the biggest priority will become the Active Router, the other one will be the Standby Router.
By default the priority is set to 100 (From 1 to 255). If the 2 routers have the same priority, the one with the biggest IP address will become the Active Router.

standby 1 track serial 0/0/0
Let say R1 is the Active router, everything is fine except the serial link between R1 and R3, so the internet connection is down, but R1 will still remain the Active router.
That’s why this command is so important, it will check the serial link, and if it goes down, it will decrement from 10 the priority. Then R2 will have a higher priority (100 > 95) and R2 will become the Active Router, thanks to the preempt command that allows to automatically let R2 become the Active router when it sees its priority bigger thant R1’s priority.

Verifications
Now let’s go on tests.
PC1 is configured this way:
IP ADDRESS> 192.168.0.60
NETMASK> 255.255.255.0
GATEWAY> 192.168.0.1
DNS SERVER> 10.19.40.1 //this is my LAN DNS server.

You can see when i use the tracert command on my DNS server, I am using the link between R1 and R3.

Tracert 1

I just can’t explain why the name in front of [192.168.0.2] is thinklabs.esi-supinfo.com … It seems to be a host in the LAN (the LAN that provides internet connectivity to f0/1 on both R3 and R4)

Now I will ping google and then unplug a wire on R1
ping

As you can see we have 2 timeout then the connection is up again 🙂

Another tracert now
ping
Still the same bug (?) with the name of the router.
But We can see that now we are using the link between R2 and R4 !

Now let’s go on PC1 and see the ARP cache.
ping

The MAC address of a virtual IP Address with hsrp will always be:
00-00-0c-07-ac-**
** will be the HSRP group number.

For security reasons, you will may want to set a secure password between your routers for the protocol HSRP to work.
You will just need to set this command on the interface configuration mode.

You also can set the password in clear text mode…

3 Comments on Hot Standby Routing Protocol (HSRP)

  1. alex says:

    w00t!!! nice article!!

  2. murtyanjay says:

    hi ….everybady

    this aritcal is very simpul understand HSRP protocol

  3. morteza says:

    hi……

    thank you .it is very simple and useful.

Leave a Reply

Your email address will not be published. Required fields are marked *