Network load balancing is the technique to manage traffic across a network without the use of complex routing protocols such as BGP. Network Load Balancing divide load across multiple links, which use the network resources more efficiently and avoid network overload. Load balancing may be accomplished through software or hardware.
Now, look at the topology in the Figure below. There are three switches with 802.1Q trunks connecting them. Two VLANs are configured in the network, VLAN 100 and 200. The purpose is to configure Switch-1 as the primary root bridge for VLAN 100 and the secondary root bridge for VLAN 200 and Switch-2 as the primary root bridge for VLAN 200 and secondary root bridge for VLAN 100.
Port F0/0 on Switch-3 is the forwarding port for VLAN 100 and blocking port for VLAN 200. Port F0/1 on Switch-3 is the forwarding port for VLAN 200 and the blocking port for VLAN 100.
We have also planned the secondary root bridge for both VLANs in case of fault of the primary VLAN. A secondary root bridge becomes the root bridge for a VLAN if the primary root bridge going fails. If other bridges in the VLAN keep their default STP priority, this switch configured as secondary root bridge becomes the primary root bridge if the primary root bridge fails. In the topology, Switch-1 is the primary bridge for VLAN 100 and the secondary root bridge for VLAN 200. So, the configurations of the switch-1 are as under:-
Switch-1(config)#spanning-tree vlan 100 root primary
Switch-1(config)#spanning-tree vlan 200 root secondary
Switch-1(config)# do wr
After configuring the switch-1, configure the switch-2. The switch-2 is the primary root bridge of the VLAN-200 and secondary root bridge for VLAN-100. The configurations of the switch-2 are is under.
Switch-2(config)#spanning-tree vlan 200 root primary
Switch-2(config)#spanning-tree vlan 100 root secondary
Switch-2(config)# do wr
We can also configure the root bridge using the bridge priority specifying the root bridge is to set the spanning-tree priority on each switch to the lowest value so that the switch is selected as the primary bridge for its associated VLAN. We can set switch priority for any spanning-tree instance. A lower value increases the chances that the switch is selected. The range is 0 to 61,440 in increments of 4,096. The configuration of root bridge priority we have done in the method of bridge priority ID configuration.
Now examine the topology, the Switch 1 is configured as the primary root bridge for the VLAN-100 and secondary root bridge for VLAN-200, and Switch-2 is configured as the primary root bridge for VLAN-200 and secondary root bridge for VLAN 100. This configuration enables spanning tree load balancing, with VLAN 100 traffic passing through Switch-1 and VLAN 200 traffic passing through Switch-2.
We can verify the configuration using show spanning-tree active command which displays spanning tree configuration details for the active interfaces only. Another command we can use the show spanning-tree command.