We help IT Professionals succeed at work.

What is Spanning Tree Protocol

what is Spanning Tree Protocol.
why it is used
can any one explain me by using topology
Comment
Watch Question

Spanning Tree Protocol is used in switched networks to find and  prevent loops between switches. It used to prevent something called broadcast storms which is traffic that keeps going from switch to switch without end and multiplying until it effect takes up all the bandwidth and brings down the switch

<SW1> port 1 =====================> <SW2> Port 1
<SW1> Port 24 ====================> <SW2> Port 24 ( this connection would be blocked in Spanning tree as it already exists and would cause a loop. should the port 1 interfaces fail then port 24 would come into play and be made active
The other element of Spanning Tree is discovery.  the reason why desktop ports that have spanning tree enabled take a while to link up is they are discovering the environment and mapping out the network (In very basic terms at least).  It gives visibility to the network to speed up communication and limit broadcast.  As a rule, I try to make my client workstations operate  with portfast enabled, this will allow them to link up immediatly, then the spanning tree functions take place as priority becomes available.  You never want your uplink ports between switches, or on servers to be on portfast as they need to go through the spanning tree process to do as EmpoweredBiz says, discover loops and accomodate them by putting blocks in place.
You can expand on Empoweredbiz's diagram by saying

SW1 ----> SW2 ----> SW3 ---> SW4 ---->SW1

Spanning tree will analyze the links and determine that there is a loop among the 4 switches, one of the links betwen one of the switches will be blocked, based on some calculations that I dont understand, but it is based on traffic, bandwidth, etc.  

In this case, if the link between SW2 and SW3 was broken, the data coming from SW2 would back flow through SW1 then 4 to get to 3.