Most of the conversation around optimizing traffic distribution between switches revolves around the use of PortChannels and scaling them up as needed. While PortChannels and other link aggregation options are often a great solution, another load sharing technique using simple Spanning Tree port priority also exists.
Spanning Tree enables load sharing between two connected switches by modifying the STP port priority for specific VLANs. Before we get into how to enable STP active/active traffic sharing across multiple switch links, we need to first review the default Spanning Tree behavior.
STP Port Priority Example
In this example, SW1 and SW2 are connected with two trunk ports (Gig1/0/23 and Gig1/0/24). VLANs 20-39 were created on both switches and are allowed on both trunk links. SW1 is the STP Root Bridge for VLANs 20-39 as we can see in the show spanning-tree vlan 20 output below.
The output above is just for VLAN 20, but we would see the same results for every VLAN between 20-39. Notice in the output above that Gi1/0/24 shows as Blocking status. That means only the trunk link on Gi1/0/23 is being used to forward frames for all VLANs. Spanning Tree is doing its job by preventing a loop from forming, but it is not using the available links as efficiently as it could. To do that, we need to use the interface-level port-priority command.
Spanning Tree Path Selection
A quick review on how Spanning Tree selects which ports to forward on:
- Root Bridge is elected – Lowest root bridge ID wins.
- Lowest cost path to the root
- Lowest sender bridge ID – When multiple uplinks are used between two switches, the sender bridge ID will be the same on both links.
- Lowest sender port ID – When multiple uplinks are used between two switches, the lowest port number will transition to forwarding while all others transition to blocking.
The port ID is actually made up of two parts: the port priority and the port index (or port number). The default port priority is 128, so left unchanged the port index will be used as the tie breaker.
In our example here, step four will be the determining factor as to which port forwards frames. Since Gi1/0/23 is lower than Gi1/0/24, it becomes the root port.
By lowering the port priority on SW1’s Gi1/0/24 interface, we can change the STP patch selection for specific VLANs. By changing the port priority on Gi1/0/24 down to 96 for VLANs 30-39, the result is Gi1/0/24 forwards traffic for only those VLANs.
Before we begin the configuration, let’s issue the show spanning-tree vlan 30 command on SW2 to verify that Gi1/0/23 is the uplink currently in the forwarding state.
Port Priority Configuration
Now we can see what happens when the port priority on SW1 Gig1/0/24 is modified for VLANs 30-39.
Notice in the SW2 output above that Gi1/0/24 is now forwarding as the Root Port. All traffic on VLANs 30-39 is now traversing Gi1/0/24 instead of Gi1/0/23. Since we only change the port priority for VLANs 30-39, traffic on VLANs 20-29 will continue to use Gi1/0/24. This is exactly how the load sharing is achieved.
The Root Bridge is not affected in any way by the change. SW1 still is the root and both ports remained in the forwarding state as can be seen below.
Finally, let’s verify that Gi1/0/23 is still in the forwarding state for VLANs 20-29.
The previous example demonstrated the ability to configure STP link load sharing across multiple trunk links by changing the port priority value for half of the active VLANs. This enables the switches to better balance the load distribution across trunk links.
Another benefit of Spanning Tree port priority load sharing is it effectively doubles the bandwidth available between the two switches. This is theoretical however; keep in mind that it only actually load balances traffic on a per-VLAN basis. If the first half of your VLANs are passing much more traffic than the second half the load balancing will not be equally distributed.
Finally, the use of EtherChannels between two directly connected switches is generally preferred over STP port priority tuning. For the CCNP exam and just practical protocol knowledge, its good to understand a STP link load sharing option is available.