So here’s switch 2, enable conf t int vlan 10 standby
now it’s important that the same group number be used on both sides
otherwise, we'll have 2 active routers in different groups
and you'd want to do that if you want to split the load
within a VLAN and use 2 separate IP addresses.
but We won’t be doing that right now
we wanted the election to take place
between this 2 switches for the same virtual router.
So we're going to specify IP address
and the IP address in our case is 10.1.10.254
we can now hit carriage return
and we won’t change the priority by default, it is 100
so if we configure that again as 100
and type do sh run int vlan 10
you’ll notice that the priority doesn’t display
because that’s the default once again.
So all I need to configure is that command
and now when we type show standby
we can see that for group 1 on VLAN 10
the local router is the standby router
the virtual IP address is 10.1.10.254
that’s the virtual HSRP router that’s been configured.
There’s the virtual MAC address
hello and hold time are set to the defaults, make sure that you set them the same
if you do change them, so make sure that it’s the same on both routers.
Preemption is disabled in this example
the active router is 10.1.10.1 and the priority is 200
in other words, switch 1 is the active router
and has a priority of 200, the local router is the standby router
and has a default priority of 100.
Back on switch 1 show standby
shows us that the router is still active
so the local router is active but the standby router of 10.1.10.2
in other words, switch 2 is now shown with its priority of 100.
So that’s how you configure basic HSRP
on the active router, we've configured this
and on the standby router, we only configure a single command.
Now once we’ve done that on router 1, which is acting as our PC
let’s see if we can ping the virtual router.
So ping 10.1.10.254 the ping works
and if I type sh arp IP address of virtual router, MAC address of virtual router.
Now this thing doesn’t exist at the moment even if I turn that off.
This router isn’t physically connected to our topology on GNS3 at all
I’m only showing the icon here to show how it fits in the topology.
So it’s not on, it's not physically connected anywhere
but router 1 acting as PC 1 is able to ping that IP address
because in actual fact it’s pinging switch 1
so on switch 1, we can use the debug, debug ip icmp
go back into router 1 and notice were getting output
on the console of switch 1, its sending an echo reply back to 10.1.10.11
which is router 1 acting as PC 1 from a source IP address of 10.1.10.254
the virtual router's IP address so debug ip icmp on router 1 acting as our PC
notice this PC believes that it's talking to this IP address
and it believes its talking to this MAC address
whereas in actual fact it's communicating with switch 1.
Now before we run a test and test fail over
we need to configure HSRP on VLAN 20
and then we'll be able to test connectivity
between router 1 and router 2
and then verify what happens when an interface goes down
I'll turn off debugging on switch 1
go into VLAN 20 standby group number
I’m going to specify 1 to show you
that you can use the same group number in different VLANs
but these are separated from each other
because they're in different VLANs
IP address 10.1.20.254 in this example
so VLAN 20 virtual IP address
that's all that I’m going to configure on switch 1
I’d like to show you how preemption works
so I’m going to wait a while
so that this router can become the active router
and then I'll enable preemption on switch 2
to show you that it forces itself to become the active router
for that VLAN when we enable preemption.
So the status speak it did change to active
but this output is when it was still in the speak stage.
So active router is unknown, standby router is unknown
local priority is 100, active virtual MAC address is unknown
but when we do show standby again
local router is now active, standby router is unknown
so active router is the local router using this MAC address.
So it’s the same MAC address on VLAN 10 and VLAN 20
but it doesn’t cause a conflict
because MAC address is on layer 2 addresses
and are contained within the relevant VLAN
so show run interface vlan 20
that’s the config of a HSRP on switch 1 for VLAN 20
on switch 2 now, int vlan 20
standby group number 1 IP 10.1.20.254 standby 1 priority 200
so let’s see if it forces itself to become active
without the preemption keyword
so do show standby preemption is currently disabled
it’s in the speak state and just gone to standby
so notice even though this router has a higher priority of 200
the active router remains the active router
because we haven’t put the preempt keyword in
to force this router to become the active router
we use the command standby 1 preempt
and what we should see and it just happened over there.
Notice state change to active
so for VLAN 20 group 1 the state just changed
and we can see that in the output.
Do the show standby command again
notice the local router is the active router for VLAN 20
group 1 and the standby router is switch 1
we can see as an example, that state change on switch 1
so preemption forces the local switch in this example
to be the active router for VLAN 20.
So what have we done, switch 1 is the active router for VLAN 10
switch 2 is the active router for VLAN 20
we have configured HSRP on both VLANs in this example
so the next step is to configure the default gateways on the PC's
and then test connectivity when an interface goes down.