Cisco HSRP and Spanning Tree Alignment Configuration

The organizations use redundancy to the protect its network from the sudden service interruption due to unavailability of default gateway router. To the optimize usage of the gateway redundancy such as Hot Standby Router Protocol (HSRP), we need to the align its operation to the networks switches spanning tree protocol (STP).

HSRP and STP Alignment Explained

To the optimize our network redundancy, we need to the design the network that aligns both the Cisco Layer 3 HSRP & Layer 2 STP redundancy services with the each other. By default, the STP is enabled on the most interconnected Cisco switches. It assigns a root bridge within interconnected switches. The root bridge is central point of all switches and will be responsible for the forwarding traffic.

HSRP, on the other hand, the will assign active and standby router based on the priority. The highest priority will the active HSRP router amongst HSRP group. All routers within cluster will have the same virtual IP address and the virtual mac address. It’s two states active & standby routers. If active HSRP router fails, the local standby router will be new active router. The standby IP address & active IP address will be same for all the routers within HSRP group. Local virtual MAC address is also same and its automatically generated by router. HSRP virtual MAC address are 0000.0c07. acXX, where XX is HSRP group numbers.

Looking’s the example network diagram above, let’s assume that Router0 the active router in network and Switch0 is root bridge, then the traffic from the PC0 will go to the Switch2 > Switch0 > Router0, while traffic from PC1 will go to the Switch3 > Switch0 > Router0. What if the Router0, the active routers, fails & goes offline, & the new active router will be Router1? The traffic path will different now. traffic from PC0 will be now go to the Switch2 > Switch0 > Switch1 > Router1 and the traffic from PC1 will now go to the Switch3 > Switch0 > Switch1 > Router1.

That traffic routes during failover is not the efficient way to the route the traffic. To the solve this we need to the align the HSRP and the STP configurations. We need to the tag a different VLAN on each of access switches, Switch2 and the Switch3.

 

Cisco HSRP and STP Alignment Configuration

To the better understand concept, let have an example using topology below. Please follow the below steps on the HSRP and STP configurations are

1. Add following commands to the Router0. We will be configuring HSRP and the add the virtual standby IP address.

Router#conf t
 
Router0(config)#interface gigabitEthernet 0/1
 
Router0(config-if)#no shutdown
 
Router0(config)#interface g0/1.10
 
Router0(config-subif)#encapsulation dot1Q 10
 
Router0(config-subif)#ip address 1.1.1.2 255.255.255.0
 
Router0(config-subif)#no shutdown
 
Router0(config-subif)#standby 1 ip 1.1.1.1
 
Router0(config-subif)#standby 1 priority 110
 
Router0(config-subif)#standby 1 preempt

 

Router0(config)#interface gigabitEthernet 0/1.20
 
Router0(config-subif)#encapsulation dot1Q 20
 
Router0(config-subif)#ip address 2.2.2.2 255.255.255.0
 
Router0(config-subif)#no shutdown
 
Router0(config-subif)#standby 2 ip 2.2.2.1
 
Router0(config-subif)#standby 2 priority 90

 

2. Add following commands to the Router1. We will configure HSRP and virtual IP address.

Router1#conf t
 
Router1(config)#interface gigabitEthernet 0/1
 
Router1(config-if)#no shutdown
 
Router1(config)#interface g0/1.10
 
Router1(config-subif)#encapsulation dot1Q 10
 
Router1(config-subif)#ip address 1.1.1.3 255.255.255.0
 
Router1(config-subif)#no shutdown
 
Router1(config-subif)#standby 1 ip 1.1.1.1
 
Router1(config-subif)#standby 1 priority 90

 

Router1(config)#interface gigabitEthernet 0/1.20
 
Router1(config-subif)#encapsulation dot1Q 20
 
Router1(config-subif)#ip address 2.2.2.3 255.255.255.0
 
Router1(config-subif)#no shutdown
 
Router1(config-subif)#standby 2 ip 2.2.2.1
 
Router1(config-subif)#standby 2 priority 110
 
Router1(config-subif)#standby 2 preempt

 

3. Add following commands to theSwitch0:

Switch0#conf t
 
Switch0(config)#spanning-tree vlan 10 root primary
 
Switch0(config)#spanning-tree vlan 20 root secondary

 

4. Add following commands to the Switch1:

Switch1#conf t
 
Switch1(config)#spanning-tree vlan 10 root secondary
 
Switch1(config)#spanning-tree vlan 20 root primary

 

5. The following are show commands to the verify our configurations.

For the Router0 and Router1:

Router#show standby

 

For Switch0 and Switch1:

Switch#show spanning-tree vlan <vlan #>

 

Post a Comment

0 Comments