STP Spanning Tree Protocol

 STP Spanning Tree Protocol


Spanning Tree Protocol (STP) enables switches to become aware of other switches through the advertisement and receipt of bridge protocol data units (BPDUs). STP builds a Layer 2 loop-free topology in an environment by temporarily blocking traffic on redundant ports.

STP operates by selecting a specific switch as the master switch and running a tree-based algorithm to identify which redundant ports should not forward traffic.

Layer 2 Loop Avoidance with STP



STP has multiple iterations:

o   802.1D, which is the original specification
o   Per-VLAN Spanning Tree (PVST)
o   Per-VLAN Spanning Tree Plus (PVST+)
o   802.1W Rapid Spanning Tree Protocol (RSTP)
o   802.1S Multiple Spanning Tree Protocol (MST)


Catalyst switches now operate in PVST+, RSTP, and MST modes. All three of these modes are backward compatible with 802.1D.

=========================================================================

STP Port States:

In the 802.1D STP protocol, every port transitions through the following states:

Disabled: The port is in an administratively off position (that is, shut down).

Blocking: The switch port is enabled, but the port is not forwarding any traffic to ensure that a loop is not created. The switch does not modify the MAC address table. It can only receive BPDUs from other switches.

Listening: The switch port has transitioned from a blocking state and can now send or receive BPDUs. It cannot forward any other network traffic. The duration of the state correlates to the STP forwarding time. The next port state is learning.

Learning: The switch port can now modify the MAC address table with any network traffic that it receives. The switch still does not forward any other network traffic besides BPDUs. The duration of the state correlates to the STP forwarding time.The next port state is forwarding.

Forwarding: The switch port can forward all network traffic and can update the MAC address table as expected. This is the final state for a switch port to forward network traffic.

Broken: The switch has detected a configuration or an operational problem on a port that can have major effects. The port discards packets as long as the problem continues to exist.

-----------------------------------------------------------------------------------------------------------------------------


Bridge protocol data unit (BPDU): This network packet is used for network switches to identify a hierarchy and notify of changes in the topology. A BPDU uses the destination MAC address 01:80:c2:00:00:00. There are two types of BPDUs:

Configuration BPDU: This type of BPDU is used to identify the root bridge, root ports, designated ports, and blocking ports. The configuration BPDU consists of the following fields: STP type, root path cost, root bridge identifier, local bridge identifier, max age, hello time, and forward delay.


Topology change notification (TCN) BPDU: This type of BPDU is used to communicate changes in the Layer 2 topology to other switches. This is explained in greater detail later in the chapter.

Root Bridge:

The Root Bridge ID is used to determine which switch becomes the root bridge. The Bridge ID is an 8-byte value. It consists of two main parts:

Bridge Priority: A configurable value. Lower values have higher priority.  

MAC Address: The switch's unique Media Access Control address.

Root Bridge Election Process
  1. Switches exchange Bridge Protocol Data Units (BPDUs) to compare Bridge IDs.
  2. The switch with the lowest Bridge ID is elected as the root bridge.
  3. If multiple switches have the same bridge priority, the switch with the lowest MAC address becomes the root bridge.

STP Timers

Max age: This is the maximum length of time that passes before a bridge port saves its BPDU information. The default value is 20 seconds, but the value can be configured with the command spanning-tree vlan vlan-id max-age maxage. If a switch loses contact with the BPDU’s source, it assumes that the BPDU information is still valid for the duration of the Max Age timer. If a switch doesn't receive a new BPDU within the Max Age timeframe, it assumes a topology change has occurred and initiates the STP process to recalculate the spanning tree. It ensures that switches have up-to-date information about the network to maintain a loop-free topology.

Hello time: This is the time that a BPDU is advertised out of a port. The default value is 2 seconds, but the value can be configured to 1 to 10 seconds with the command spanning-tree vlan vlan-id hello-time hello-time.

Forward delay: This is the amount of time that a port stays in a listening and learning state. The default value is 15 seconds, but the value can be changed to a value of 15 to 30 seconds with the command spanning-tree vlan vlan-id forward-time forward-time.

STP Path Cost-
Spanning Tree Path Cost is very important in measuring the cost to reach the next root bridge. This helps the switch in identifying which port should be blocked.
  • 10 Mbps link path cost is 100
  • 100 Mbps link path cost is 19
  • 1 Gbps link path cost is 4
  • 10 Gbps link path cost is 2
  • 20 Gbps link path cost is 1
  • 100 Gbps link path cost is 1
  • 1 Tbps link path cost is 1
  • 10 Tbps link path cost is 1
 

Comments

Post a Comment