Technology

Introduction to Spanning Tree

What is spanning tree, what is the purpose of this protocol, where does it work?

These questions are easy to answer. Spanning-tree is a Layer 2 Ethernet loop prevention protocol that operates on Ethernet switches, that’s it, nothing else stops. That’s all that spanning tree does.

Why do we need this protocol? Imagine a network with two Layer 1 hubs connected to each other via a pair of Ethernet cables and a PC connected to each of the hubs. When any of the PCs send any communication to the cable, the connected hub will flood the data from both interfaces to the other hub, the receiving hub will send the received communications to the PC and it will go back to the other interface back to the original one. hub, this communication will continue around the network until one of the links is dropped, this is known as a loop, sometimes also called a broadcast storm.

Broadcast storms are fatal to your network, causing both voice and data outages. We no longer use hubs in modern networks, we normally use switches due to their functionality and characteristics, the main feature of a Layer 2 switch is the spanning tree.

Now imagine the same network described above with two switches instead of two hubs. Now, instead of all four ports being in the forwarding state, the spanning tree will determine through various choices and weights to block a single port in our little topology, now when any of the PCs connected to the switches send a transmission over the cable, there will no longer be any looping traffic due to the blocked port.

We have to learn how the spanning tree decides which port or ports to block to prevent a loop or loops from occurring in our network.

The first thing to do to understand the spanning tree is to imagine this, you leave your house to get to the office, at the crossroads at the top of the street you stop, turn left, right or go straight on? Your decision as to which route to choose is based on your knowledge of the location of the office.

STP works exactly the same way, spanning tree will choose a device to act as a benchmark, this benchmark will advertise to other spanning protocols on other switches, when a switch receives the benchmark on more than one port will decide which port is more preferable based on link settings such as link bandwidth, port priority, and port number. Once the network switches decide which ports to forward and which to block, STP has done its job.