Spanning Tree Protocol
The Spanning Tree Protocol (STP) is a network protocol that ensures a loop-free topology for any bridged Ethernet local area network. The basic function of STP is to prevent bridge loops and ensuing broadcast radiation.
Spanning Tree defines 3 port roles. They are:
- Root Port
- Designated Port
- Blocking (Alternative Port)
The following states show in sequential order the various states that a port transitions through once the port is opened.
- Blocking – As the name suggests the port blocks all traffic and does not participate in frame forwarding / receiving. Due to this no MAC address are learnt. Though BPDU`s from neighbouring switches are excepted.
- Listening – The port still cannot forward or receive frames but can receive and send BPDU`s.
- Learning – Once the port is in the learning state the port starts learning MAC address.
- Forwarding – When in the forwarding state the port sends/receives frames and BPDU`s in addition to populating its MAC address table.
- Disabled – The port is administratively shutdown.
4. SPANNING TREE STEPS
Spanning Tree consists of the following steps:
- Root Bridge election
- Root Port election
- Designated Port election
- Alternative (Blocking) Port election
Root Bridge Election
The bridge with the lowest bridge ID is elected as the root bridge. The bridge ID comprises of the following:
- Priority number
- MAC address of bridge
Example: 32768.00:00:00:00:00:01 / [Priority number].[MAC Address]
During the Root Bridge election process the Priority number is compared first. If the Priority number is equal then the MAC address is then used.
Root Port Election
Each port that has the lowest path cost to the Root Bridge is assigned the role of the root port. The path cost is calculated by the accumulative cost of all paths to the Root Bridge.
- Root Ports are only assigned to non-root bridges.
- Each non-root bridge only has 1 root port
Designated Port Election
Each port with the lowest accumulative path cost to the root bridge is assigned the role of designated port.
- Every segment (path) has one designated port.
- Designated Ports are assigned to all bridges (non-root and root).
In the event of 2 ports having the same path cost the neighbouring switches bridge ID is used. Again the lowest bridge ID wins.
Alternative Port Election
All remaining ports are set to Alternative and the state transitioned to blocking.
Below shows an example of Spanning Tree before and after transition.