askvity

What is STP and its types?

Published in Networking Protocols 4 mins read

STP, or Spanning Tree Protocol, is a Layer 2 network protocol that prevents loops in a network topology, and several variations or types of STP exist to improve its efficiency and scalability.

What is Spanning Tree Protocol (STP)?

Spanning Tree Protocol (STP) is designed to manage redundant paths in a network, which can cause broadcast storms and other issues. It works by logically blocking redundant paths, ensuring that there is only one active path between any two network devices. If the primary path fails, STP automatically unblocks the redundant path to restore connectivity.

How STP Works:

STP operates by:

  • Electing a Root Bridge: The switch with the lowest Bridge ID (BID) is elected as the root bridge. The BID consists of a priority value and the switch's MAC address.
  • Determining Root Ports: Each non-root bridge identifies the port with the lowest cost path to the root bridge. This port becomes the root port.
  • Designating Designated Ports: On each network segment, the port with the lowest cost to the root bridge is designated as the designated port.
  • Blocking Redundant Ports: All ports that are neither root ports nor designated ports are blocked to prevent loops.

Types of STP:

Several versions of STP have been developed to improve convergence time and efficiency:

  • Common Spanning Tree (CST): The original STP standard (IEEE 802.1D). It uses a single spanning tree for the entire network, which can be inefficient in larger networks with multiple VLANs.

  • Per-VLAN Spanning Tree (PVST): A Cisco proprietary extension that runs a separate instance of STP for each VLAN. This allows for better load balancing and optimization, as different VLANs can use different paths. PVST+ is an enhancement that supports both Cisco and IEEE 802.1Q VLANs.

  • Rapid Spanning Tree Protocol (RSTP): Defined in IEEE 802.1w, RSTP significantly reduces convergence time compared to the original STP. It achieves faster convergence by using new port roles and handshake mechanisms. RSTP is backward compatible with the original STP.

  • Multiple Spanning Tree Protocol (MSTP): Defined in IEEE 802.1s, MSTP allows multiple VLANs to be mapped to a single spanning tree instance (called an MST instance or MSTI). This reduces the number of STP instances needed compared to PVST, making it more scalable. MSTP is backward compatible with RSTP.

Protocol Description Advantages Disadvantages
CST Original STP standard, one spanning tree for the entire network. Simple to configure. Inefficient for large networks with multiple VLANs, slow convergence.
PVST Cisco proprietary, separate STP instance per VLAN. Better load balancing, VLAN-specific optimization. More overhead than CST, Cisco proprietary.
RSTP Faster convergence compared to CST. Faster convergence, backward compatible with STP. Still uses one instance per network (or per VLAN in PVST+), potentially less scalable.
MSTP Multiple VLANs mapped to single spanning tree instance. Scalable, reduces STP instances, backward compatible with RSTP. More complex to configure than CST or RSTP.

Understanding these different types of STP is crucial for designing and managing robust and efficient network topologies. Selecting the appropriate STP version depends on the size and complexity of the network, as well as the desired level of convergence speed and scalability.

Related Articles