Configuring basic HSRP
Posted on 25 March 2019 by Beaming SupportTo ensure high availability in a business environment using Cisco routers we are able to use a proprietary protocol called HSRP (hot standby routing protocol).
This allows 2 routers to determine which will be active and which will be standby. One of the key features of running this redundant gateway protocol is the configuration on the client end, for example the computer that you can see in the bottom of the diagram only needs to configure 1 default gateway.
Base configuration on R1: | Base configuration on R2: |
!
Hostname R1 ! ! Interface GigabitEthernet0/0 ip address 192.168.1.252 255.255.255.0 ! |
!
Hostname R2 ! ! Interface GigabitEthernet0/0 ip address 192.168.1.253 255.255.255.0 ! |
Now we will add the relevant commands to configure HSRP, please see this below.
R1: | R2: |
int gig 0/0
standby 1 ip 192.168.1.254 standby 1 priority 110 standby 1 preempt |
int gig 0/0
standby 1 ip 192.168.1.254 standby 1 priority 90 |
The command “standby 1 ip 192.168.1.254” does several things:
The “standby 1” portion of this command says that our standby group number will be 1. Note that when configuring HSRP both routes must use the same group.
The “ip 192.168.1.254” portion of the command says that 192.168.1.254 will be our virtual gateway.
This virtual gateway will be assigned to the active router with the command “standby 1 priority x”. The standby 1 portion of the command has the same meaning as it did before but “priority x” will determine which router will be active and which router will be standby; the router with the highest priority will be the active router, so in our scenario this will be R1.
There is one command that we have configured on R1 that we do not have on R2. This command is “standby 1 preempt” . The “preempt” will tell the standby router “if I have a higher priority than you I will instantly take over the role as the active router”. Please note that without this command this is how the election will take place.
R1 is currently the active router and R2 is standby, R1 loses power so R2 then becomes the active router. When R1 is back up and running it then becomes the standby router; the election has already taken place so R2 will stay as the active router until there is a re-election or there is a router with a high priority that has just joined HSRP and is using the preempt command.
We're networking experts
Beaming is an Internet Service Provider for businesses, so we know our stuff when it comes to networks.
Found this useful?
Our team share their how-tos, trouble shooting guides and tips for getting the best from your business connectivity in a monthly email round up.