"Pass your IT exams by learning with our world class consultant trainers. Your hands on course comes with a 100% satisfaction money back guarantee and lifetime e-mail support to give you the very best chances of passing." This tutorial has been written and prepared by http://www.networksinc.co.uk
Spanning Tree Protocol was developed as a method of loop prevention on LANs. It allows bridges to communicate with each other so they can create a loop free topology. Each bridge runs an algorithm which calculates how the loop can be prevented.
STP has only one purpose, to prevent loops occurring on a network by blocking connections that could cause a loop. When a port sees a loop in the network it blocks one or more redundant paths preventing a loop forming. This is achieved by STP electing a root bridge on the network. Then each other bridge selects one of its ports with the least path cost to the root bridge. The least cost path is determined by STP looking at the bandwidth of the link.
STP continually monitors the network always looking for failures on switch ports or changes in the network topology. If a change is notices STP can quickly make redundant ports available and close other ports to ensure the network continues to function.
How are loops caused? Very easily, LANs are designed to provide redundancy so that if a particular link fails another one can take over passing the frame across the LAN. Each switch port on a LAN hears a hosts MAC address and sends a message around the network telling the other switches that it knows how to get to host X.
FIG 3.4 A Switching Loop is Easily Caused
The problem starts when another switch discovers hosts X’s MAC address. As time passes every switch on the network thinks it knows how to get to PC X and a loop has formed. A loop can very quickly bring down your network.
Spanning tree works by selecting a root bridge on the LAN. The root bridge can be though of the centre of a web. It is selected by comparing each others MAC address and priority value. The default priority value of on all devices running STP is 32768.
When the root bridge is selected the other switches then the other switches elect a port with the least path cost to use on the LAN.
The root bridge on a LAN is selected by an election taking place. Each switch running STP passes information in a format called bridge protocol data units (BPDUs). When the switch or bridge priorities combined with its MAC address are all exchanged the bridge with the highest ID is selected as the root bridge.
All ports on the root bridge are known as designated ports. On nonroot bridges only one port can be designated, all others are blocked. Designated ports forward MAC addresses. Designated ports are selected after the bridge determines the lowest cost path to get to the root bridge.
Root bridge ports are known as designated ports and are in what is known as forwarding state. Forwarding state ports can send and receive traffic. All of the other bridges present are known as nonroute bridges, they choose a port known as a root port which sends and receives traffic.
By using this method, the redundant links are closed down. They can be opened again if there is a change in network topology and the link is needed once more.
Bridge ports running STP can be in one of four states:
- Listening - listens to make sure no loops occur before passing frames
- Learning - learns MAC addresses but does not forward frames
- Blocking - listens but will not forward frames
- Forwarding - sends and receives frames on the port
STP in operation
In our network we can now see which segments are Ethernet and fast Ethernet.
FIG 3.5 STP Chooses Closes Down the Redundant Links
This time Switch A (nonroot bridge) advertises the fact it can get to PCX to Switch B. Switch A will only take one path to get there since port 1 is blocked. It is blocked since it is a slower link than port 0 which is on a fast Ethernet segment of the LAN.
Bridging is the same thing as switching despite what you have heard in other books. They do exactly the same job however they are different types of device. A bridge is generally a software based device and can only run one spanning tree instance per bridge. Also, there are normally only up to 16 ports per bridge.
LAN switches are hardware based, the have a special chip used to store the MAC addresses known as an application specific integrated circuit (ASIC). Switches support multiple instance of spanning tree per switch and they also can have more than 16 ports (more than 100 on some models).
Spanning tree is turned on by default on Cisco switches.