Now you could configure a PC with 2 default gateways
in other words set the default gateway to switch 1
and switch 2 but that doesn’t work very well in windows
and other operating systems
so I can go to my local area connection, go to properties
change the properties for IPv4
and try and configure multiple default gateways
but that’s not going to work very well at all.
So it’s better to set the PC's to use a single default gateway
which in this case is the HSRP virtual router
and it’s important to remember that this is a virtual router
not a physical router it doesn’t actually exist in our topology
but these PC's will be configured to talk
to the relevant virtual IP addresses in the same VLAN
and 1 of the physical switches will forward the traffic
on behalf of the virtual router.
That’s once again determined through an election
the device with the highest priority will become the forwarder for a VLAN.
So as an example, we'll configure switch 1 with the priority of 200 on VLAN 10
and switch 2 with the priority of 200 on VLAN 20
to ensure that switch 1 becomes the active forwarder
or active router for VLAN 10
and switch 2 becomes the active router for VLAN 20
we'll then test that failover actually takes place
by doing a continuous ping between our PC's.
Here’s the console of switch 1 at the moment
sh ip int brief
shows us the IP addresses configured
on the relevant Switch Virtual Interfaces or SVIs on the switch.
We'll start with VLAN 10
so that’s the IP address configured on switch 1
I'm going to type conf t
to go to global config mode
and then I’ll go to interface VLAN 10
pressing question mark we can see the option standby
which allows us to configure HSRP, so standby ?
You can create multiple groups that allow you to split
the sharing of who is the active router within a VLAN
I’m not going to do that here, I'll simply creates a group of 1.
Now you may want to make the group number the same as the VLAN number.
In this case, I’m not going to do that because I simply want to show you
that the same group number can be used on multiple VLANs
so standby 1 specify an IP address
and in this case, it’s the IP address of our virtual router
which is going to be 10.1.10.254 for VLAN 10
this HSRP router once again doesn’t exist
we're simply configuring the virtual router.
In this case, I’m going to configure a priority rather a standby priority
of 200 the default is 100 but I want to influence the priority
to ensure that switch 1 becomes the active router for VLAN 10.
we can see already that this switch become the active router for VLAN 10 group 1
if I do a show command, standby 1 preemption
what preemption does is ensure that switch 1
becomes the active router when it’s up, so switch 1 went down
and switch 2 then became the active router, while switch 1 is down
when switch 1 comes back again preemption will ensure that switch 1
becomes the active router again
so it will basically force itself to become the active device.
we can view HSRP information by using the command show standby
as you can see here VLAN 10 has group 1 configured
the local router is the active router
the virtual IP address is configured as follows.
The active virtual MAC address is this
so this is an HSRP MAC address
this virtual router on VLAN 10 is using this MAC address.
This portion of the MAC address is the HSRP well known MAC address
so that is a reserved address for HSRP and this portion of the MAC address
is a hexadecimal representation of the group number.
Now we created group 1, so in hexadecimal, it's shown us 01
if we had created a group of group 10 it would show us 0A
A being hexadecimal for 10.
Hello's are sent every 3 seconds, the hold-time is 10 seconds.
at the moment, no hello's are being received from switch 2
so switch 1 has become the active forwarder
if there are multiple routers in the topology
they will send keep-alive to each other
and that is how they know whether the other device is available
as an example, when switch 2 is configured
it should be receiving hello's from switch 1 every 3 seconds
if it doesn’t for a period of 10 seconds, it will become the active router.
So it will move from standby to active and we'll test that in a moment.
preemption is enabled the active router is the local router,
the standby router currently is unknown
we haven’t configured switch 2 with HSRP
so switch 1 doesn’t know about any standby router
at the moment, the local priority of the router is 200
and this is the group name which is the default group name.
So let’s configure switch 2 and see what happens in the election
we'll configure switch 2 for VLAN 10
and then we'll configure both routers with HSRP on VLAN 20.