Network Journal

The journal and studies of a network enthusiast

Posts tagged port priority

2 notes

Load Balancing Using Spanning Tree

Problem

I had a number of VLANs either side of a fibre optic trunk (8-core) between two buildings connected via two Cisco catalyst switches. The switches had 4 of the fibres connected in two pairs for redundancy. If one of the fibres failed the other would come online. Spanning tree is used to make sure both links don’t come up at once and create a Layer 2 network loop.

By default spanning tree would drop one port for all VLANs (making the link unavailable) and bring one up for all traffic. This is not an efficient use of resources. What I required was to load balance over the two links, sending VoIP traffic down one link and data down the other.

Details

  • Main Switch: Cisco 4500 Supervisor.
  • Other Switch: Cisco 3560.

The default spanning tree setup would do this. Note that the main switch is the root bridge by default:

 

Note that data will traverse the links on Gi1/1 for all traffic (both VLANs).

Solution

The solution was to manipulate the way in which spanning tree selects the root bridge and how it selects which ports to block on a per VLAN basis.

First we manipulate the other switch so that it becomes the root bridge on VLAN 2:

OtherSwitch(config)#spanning-tree vlan 2 priority 0

We can also ensure that the main switch stays the root bridge on VLAN 1:

MainSwitch(config)#spanning-tree vlan 1 priority 0

Finally we manipulate the respective ports so they do not block (by setting their priority to 0):

 

MainSwitch(config)#int gig1/1

MainSwitch(config-if)#spanning-tree vlan 1 port-priority 0

OtherSwitch(config)#int gig1/1

OtherSwitch(config-if)#spanning-tree vlan 1 port-priority 0


OtherSwitch(config)#int gig1/2

OtherSwitch(config-if)#spanning-tree vlan 2 port-priority 0

MainSwitch(config)#int gig1/2

MainSwitch(config-if)#spanning-tree vlan 2 port-priority 0

You can confirm the status of the ports by issuing the show spanning-tree command in global configuration mode on each of the switches.

When VLAN 1 traffic is sent over the trunk the following topology will apply:

But, when VLAN 2 traffic is sent over the trunk the following topology will apply:

Note the different port that is blocked, and also note that a different fibre optic is being used to send the data. Now we can use two links to send data simultaneously without worrying about creating any loops in the network.

The important point here is that we still maintain a redundant network, if either of the links fail the other will be used to send traffic from both VLANs.

If we simply put the Gi1/1 ports on VLAN 1 and Gi1/2 ports on VLAN 2 we would not failover in the event of a cable/port failure because we would no longer be using spanning tree.

Filed under spanning tree redundancy link failure vlan voip data trunks ethernet port priority STP RSTP