Search This Blog

Monday, September 6, 2010

Redundant Gateway Routing Protocol - HSRP

In the above diagram we have 2 Layer 3 switches and 1 Layer 2 switch and 1 PC. The goal of this exercise is to provide the PC a redundant path out of it's own network. The network is 10.1.1.0/24 and is located in Vlan 2. The link connecting ASW1 to the PC is a basic access link and the port has been placed into Vlan 2. The 2 links connecting ASW1 to CSW1 and 2 are 802.1q trunk links. The link between CSW1 and 2 is a layer link, the network connecting them is 10.100.1.0/30.

PC's IP is 10.1.1.100/24 with a gateway of 10.1.1.1. In a standard situation without HSRP only one of the CSW switches could act as the gateway for PC.

But what if CSW1 was chosen to do so and that device failed?

Well that is where HSRP comes into play! Hot Standby Routing Protocol is a Cisco proprietary technology that allows a Network professional to provide redundancy in their network for hosts.

HSRP creates a virtual layer 2 and layer 3 address so that a host (PC) can reach outside its network even though its active gateway is down.

In the HSRP config I have created for this example I have placed CSW1 as the active gateway and CSW2 as the standby gateway.

On CSW1 I created a SVI (Switches Virtual Interface) interface called Vlan 2 and gave it an IP address of 10.1.1.2/24, I have done the same on CSW2 but I used an address of 10.1.1.3/24. The IP addresses must be unique. Example: from global config mode type 'int vlan 2' this will create the switched virtual interface for vlan 2. You will still have to config the actual vlan and any VTP you may want to use on your network as well.

Now to start HSRP we will go in to both Interface Vlan 2's on CSW1 and CSW2 and type the following commands.

CSW1
standby 2 ip 10.1.1.1 <---this sets the VIP (Virtual IP for group 2)
standby 2 pri 1 <--- this sets a priority number for the interface, the lowest number will become the active gateway interface, CSW1 is being told to become the active)
standby 2 pre <--- the preempt command is used for when a failure occurs. If CSW1 was the active gateway and it went down CSW2 would take over as the active gateway. The preemption command tells this gateway to not become the active gateway when it comes back online. You would want this so another convergence on the network does not take place which by default can take about 5 seconds.

CSW2
standby 2 ip 10.1.1.1 <---this sets the VIP (Virtual IP for group 2)
standby 2 pri 2 <--- this sets a priority number for the interface, the lowest number will become the active gateway interface, CSW2 is being told here to become the standby)
standby 2 pre <--- the preempt command is used for when a failure occurs as stated int he CSW1 config, if CSW2 becomes the active and stays active and then has a failure the role of active would switch back over to CSW1, and when CSW2 comes back online it will stay in standby.

As for PC, well all it needs is its basic IP address config including the gateway address of 10.1.1.1. The host PC has no idea that HSRP is running on the network. PC communicates with the VIP and VMAC!

That is it for the HSRP config for Vlan 2. You can create more SVI's for your other Vlans and create standby groups by following the same example above just remember to change the group #!! It is really easy to implement a redundant gateway protocol and can mean the difference between a user being down for the count when disaster strikes on your gateway devices or unknowing skirting the disaster all together!!

I plan to follow this blog about HSRP up with 2 more for HSRP in your DMZ network and how to balance Vlans across your redundant gateway devices using PVST+.

As always thank you for reading and please feel free to leave comments and or suggestions.

No comments:

Post a Comment