In this article we’ll be discussing in detail about one of the important topics in CISCO switching, the Cisco spanning tree protocol or CISCO STP as you call it. So we’ll start right from the basics, what is STP network and the need for STP networking.
So what is STP? STP is a derivative of network redundancy which is very common in business networks. Let me explain it the simple way.
Suppose you have a situation where you need to connect two switches in your office network, and then you decide to put two connection cables between the switches so that in case if any one of the link fails then the other one can take over (network switch redundancy). This is the simplest redundancy scenario and it’ll look like this.
However, in these cases there’s a possibility that data frame units may loop around the network continuously causing overload to the processors [Diagram 1]. This is where spanning tree comes into action. It was developed in order to avoid these looping, by temporarily blocking the redundant links [Diagram 2] and enabling them only when the active links are down.
Here’s a typical redundant network topology.
How does STP work?
There’s a whole bunch of processes taking place inside the STP switch for convergence. Let’s see them in detail by taking the simple network topology below. Our aim is to break up any one of the link logically thus avoiding the loop.
- All the switches in the network multicast BPDU’s (Bridge Protocol Data Unit) to discover if there are any loops out there. BPDU’s are data frames that contain STP parameters.
- If a switch receives back its own BPDU, it establishes that there are loops in the network.
After the discovery of loops there are a series of elections going on between the switches. Let’s study them step by step.
Election of Root Bridge
- Each switch has a Bridge ID which is a combination of its priority value and MAC address. The priority can be any value between 0-65535. By default the priority value of switches are 32768.
Bridge ID= Priority Value + MAC Address
- The switches then compare their Bridge IDs and the one with the lowest value is chosen as the root bridge (reference switch for all path calculation).
Note: Lower priority value/older MAC address has higher chances to become root bridge.
Election of root ports
- Root ports are the best ways to reach the root switch. It’s calculated on the basis of port cost which depends on the bandwidth of the link. You can see the STP cost for different bandwidth below as given by IEEE
- So the port which has the least cost will be the root port.
Election of Designated port
- These are the ports that are forwarding data, and there is condition here i.e. one link can have only one designated port. All ports of the root bridge are designated ports.
- They are elected based on the lowest cost, and if there is tie there then the port of the switch which has the least bridge id becomes designated port.
Election of Non-Designated port
- All other remaining ports are the non-designate ports or blocking ports. These are the ports which prevents the loop by means of the tree (blocking).
Configuation and verification:
Everything we discussed above like the loop discovery and election process takes place automatically within the switches. You can view the switch configuration by the privilege mode command ‘show spanning-tree’. Look at the screenshot below for the possible outcome. You can check ‘show spanning-tree ?’ to find out other verification commands.
However you can change the switch priority through certain command. May be we can discuss it in an upcoming advanced STP Cisco tutorial.
There is an animation on the Cisco website regarding STP protocol, it helps a lot in understanding convergence/ election of Root Bridge.
Thanks for your time and please let me know if this article was helpful to you anyway by commenting below.