STP and Link Load Sharing

I want to share an example of Spanning Tree link load sharing across parallel paths between the same switches. Most organizations do not tune their STP topology to this level, but the example helps explain a major use of the port priority option and how it works.

Let’s assume we have two switches, a multilayer distribution switch and a simple access layer switch. The switches are connected using two parellel links for redundancy.

Spanning tree will automatically put Gig0/11 on AccessSwitch in the blocking state (assuming the root bridge is above the distribution switch) because its sending port (Gig0/1) has the highest sending port number.

A quick review on STP path selection from the Spanning Tree page:

  • Lowest root bridge ID – We are assuming a switch in the core claims this title
  • Lowest path cost to the root – Again, the root is assumed to be above the distribution switch and that won’t influence which port is blocked here since both paths will have an identical cost
  • Lowest sender bridge ID – Because both links on the access switch connect to the same switch, the sender bridge ID will be the same on both links
  • Lowest sender port ID– This is how Gig0/11 goes into a blocking state – Gig0/0 is lower than Gig0/1 (again, lower sender port ID), which causes Gig0/10 to win, and transitions into forwarding

Recall that the port ID is actually made up of two parts: the port priority and the port index (or port number). Because we haven’t manually changed any port priorities yet, both distribution switch port priorities will be the default of 32 and the port index will be used as the tie breaker.

By default, all traffic for all VLANs will traverse the left path from the access switch to the distribution switch. Now let’s say we want to do some simple VLAN load balancing across the two links. Why not use both if we have the bandwidth?

STP Link Load Sharing

One way to accomplish this is with STP port priority. We can set one port priority value for the first half of VLANs and a different priority value for the other half.

DistSwitch(config)# interface gig 0/0
DistSwitch(config-if)# switchport mode trunk
DistSwitch(config-if)# spanning-tree vlan 1-10 port-priority 15
DistSwitch(config)# interface gig 0/1
DistSwitch(config-if)# switchport mode trunk
DistSwitch(config-if)# spanning-tree vlan 11-20 port-priority 15

Now VLAN 1-10 traffic will be forwarding on the left link (via gig0/10) and only use the right path as a backup. The reverse is also true. VLAN 11-20 traffic will be forwarding on the right link (via gig0/11) and only use the left path as a backup.

Both paths are forwarding in a deterministic manner and you have effectively doubled the bandwidth available between the two switches. The only major limitation of this design is that it only load balances 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. A better approach would be to use an EtherChannel between the two switches, but it wouldn’t help demonstrate STP port priority.

I hope you found the example helpful. If you have further questions, feel free to leave a comment below.

Author Aaron

Aaron knows networks. He's been involved in building and supporting world-class data networks for the past 10 years - from international cloud service providers to Fortune 50 data centers. Aaron consults independently and is focused on building the best training platform available.

More posts by Aaron

Leave a Reply