The original version of the spanning tree protocol comes from the IEEE 802.1D standard.
It provides support to ensure a loop free topology on a single VLAN by transitioning network ports through various states (some are timed delayed by a STP Forwarding timer that by default is 15 seconds):
|Disabled||The port is in a shut down state.|
|Blocking||The switch port is in a non shut down state but is not forwarding any traffic to ensure that a loop is not created. A port in this state can receive BPDUs from other switches but the switch does not update its MAC address table.|
|Listening||The switch port has changed from a blocking state. It can now send or receive BPDUs but does not forward any other network traffic. A port stays in this time for as long as configured by the STP Forwarding timer. After the STP Forwarding timer expires it moves to the learning state.|
|Learning||The switch port can modify the MAC addresss table with any network traffic that is received on the port although it continues not to forward any network traffic destined or sourced through the network port. Similar to the Listening state the port remains in this state for the duration of the STP Forwarding timer.|
|Forwarding||The switch forwards all network traffic sourced or destined to this port and updates the MAC address table as usual. There are no more time delayed transitions in this state.|
|Broken||The switch has picked up on a configuration or operational problem and discards traffic on the port for as long as the configuration or operational problem exists.|
Along with the states that a port can exist in, network ports can have roles assigned to them too:
|Root Port (RP)||This network port has a link directly to the root switch in the STP topology or an uplink to the root switch via another switch. There can be only one root port on a switch for each VLAN.|
|Designated Port (DP)||This network port receives and forwards BPDU frames to other switches via this link. Designated ports provide connectivity to switches further down the tree from the root switch. In a link between two switches there should only be one designated port and the other is a root port.|
|Blocking Port (BP)||This port is blocked from forwarding and has the Blocking state assigned.|
Components of Spanning Tree Protocol
The root bridge is the most important switch in the data link topology. All of a root switches ports are in a forwarding state as Designated Ports. This switch is considered the source master switch for all path calculations by other switches.
Bridge Protocol Data Unit (BPDU)
This network packet is used by network switches to develop a spanning tree topology and notify of changes in this topology. A BPDU packet uses a destination MAC address of 01:80:C2:00:00:00. There are two different types of BPDU packet.
Topology Change Notification (TCN) Bridge Protocol Data Unit
The first type of BPDU is sent to communicate changes in the data link topology to other switches.
Configuration Bridge Protocol Data Unit
The second type of BPDU is used to identify the root bridge in the topology, designated ports and blocking ports. The configuration BPDU packets contains a number of fields:
Root Path Cost
This is the total cost to for a specific path to reach the root switch in the topology
Root Bridge Identifier
This is the combination of the root switch MAC address, a system ID extension and the system priority of the root bridge.
Local Bridge Identifier
This is combination of the local switches MAC address, a system ID extension and the system priority of the local bridge.
If a switch loses contact with a BPDUs source device, it will assume that the last received BPDU is valid for the duration of the Max Age timer set. This can be configured with the command
spanning-tree vlan X max-age Y
This is the frequency that a BPDU is advertised out of a port. The default value is 2 seconds but can be configured between 1 to 10 seconds with the command
spanning-tree vlan X hello-time Y
This is the amount of time that a port will stay in a listening state, and then a learning state. The default 802.1D value is 15 seconds but can be changed between a value of 15 to 30 seconds with the command
spanning-tree vlan X forward-time Y
Spanning Tree Costs
The path to a root bridge is optimised based on the cumulative interface cost to reach that root bridge. The STP cost was originally stored as a 16-bit value with a reference value of 20Gbps (short-mode) but this can be changed on some switches to a long-mode configuration with a 32-bit value and a reference speed of 20 Tbps. The command
spanning-tree pathcost method long will change the device to use long mode calculations and references.
|Port Speed||Short Mode STP Cost||Long Mode STP Cost|