Friday, January 6, 2012

Cisco 3750 HSRP: with per VLAN load sharing instead of just HA (High Availability)

I did a pretty cool little thing today with two 3750 Cisco switches.  I have a customer that has two 3750s setup as a redundant core.  If one fails, the other takes over.  Its called HSRP, and it works pretty well.  However, I noticed that on the primary (active) 3750, the cpu utilization was really at various times.  So, I thought I would separate the traffic as best as I could so that the primary took most of the vlans and the secondary took one vlan in particular (vlan 102).  I happened to know for sure that vlan 102 had a ton of traffic on it, so I made my decision based on that.  So, instead of the primary taking all the heat while the secondary sat idle waiting on a failed primary, I decided to load share them.  Here is what the config looks like:
*****PRIMARY SWITCH*****:
interface Vlan10                               <----------- Active vlan on Primary
 description 1st floor
 ip address 10.232.10.250 255.255.255.0      <----------- Real IP address of vlan interface
 no ip redirects
 standby 10 ip 10.232.10.254           <------------ Virtual IP address shared between Primary and Secondary for vlan 10
standby 10 timers 3 7                       <----------- Send hellos every 3 seconds, switch over to secondary after 7 seconds
 standby 10 priority 110                   <----------- Notice the priority command for vlan 10, higher than the default of the secondary switch

interface Vlan102                              <----------- Not Active vlan on Primary
 description 2nd floor
 ip address 10.10.2.254 255.255.252.0       <----------- Real IP address of vlan interface
 standby 102 ip 10.10.2.1                   <------------ Virtual IP address shared between Primary and Secondary for vlan 102

*****SECONDARY SWITCH*****:
interface Vlan10                            <----------- Not Active vlan on Secondary
  description 1st floor
 ip address 10.232.10.251 255.255.255.0        <----------- Real IP address of vlan interface
 no ip redirects
 standby 10 ip 10.232.10.254         <------------ Virtual IP address shared between Primary and Secondary for vlan 10
 standby 10 timers 3 7

interface Vlan102                           <----------- Active vlan on Secondary
 description 2nd floor
 ip address 10.10.2.253 255.255.252.0         <----------- Real IP address of vlan interface
 standby 102 ip 10.10.2.1                <------------ Virtual IP address shared between Primary and Secondary for vlan 102
 standby 102 timers 3 7                   <----------- Send hellos every 3 seconds, switch over to secondary after 7 seconds
 standby 102 priority 120                <----------- Notice the priority command for vlan 102, higher than the default of the primary switch

I like this.  So lets look at the "show standby brief" command for both:
*****PRIMARY SWITCH*****
pricoreswitch#sho stand bri
                     P indicates configured to preempt.
                     |
Interface   Grp Prio P State    Active          Standby         Virtual IP
Vl10        10  110  P Active   local           10.232.10.251   10.232.10.254    <--------------  Active
Vl102       102 100    Standby  10.10.2.253     local           10.10.2.1         <-------------- NOT Active

*****SECONDARY SWITCH*****
seccoreswitch#sh standby bri
                     P indicates configured to preempt.
                     |
Interface   Grp Prio P State    Active          Standby         Virtual IP
Vl10        10  100    Standby  10.232.10.250   local           10.232.10.254        <-------------- NOT Active
Vl102       102 120  P Active   local           10.10.2.254     10.10.2.1            <--------------  Active

 Now, we have a "load sharing" scenario between the two HSRP 3750 switches.  Very cool. 
Oh wait, what happens if I power down a switch?  Well, here is what happens when I powered down the secondary 3750:
*****PRIMARY SWITCH*****
pricoreswitch#sho stand bri
                     P indicates configured to preempt.
                     |
Interface   Grp Prio P State    Active          Standby         Virtual IP
Vl10        10  110  P Active   local           10.232.10.251   10.232.10.254    <--------------  Active
Vl102       102 120  P Active   local           10.10.2.253     10.10.2.1            <--------------  Active

Secondary was powered off, so no readings there.  Just like a real failure.