What is STP/Spanning Tree Protocol?

What is STP/Spanning Tree Protocol?

 When configuring a network, the network may be looped to ensure redundancy. However, in such a configuration, broadcasts and all kinds of communication data will circulate forever on the configured network.

 Layer 2 headers do not have a TTL (Time To Live) value. That's why it keeps looping forever. As a result, the switch's CPU load increases, and the switch's processing capacity is exceeded. put away.

 So, to prevent this cycle, we use Spanning Tree Protocol (STP). The Spanning Tree Protocol is standardized as IEEE 802.1d. Hereafter, the spanning tree protocol will be written as STP.

 Based on the given priority, STP exchanges control information called BPDU (Bridge Protocol Data Unit) between bridges, puts any port in the blocked state, and transmits the received data frame at the blocked port. Discard.

 This prevents a data frame from continuing to circulate in a loop, even in a network that has a physical loop.

 In the case of large-scale networks, there are many cases in which a spanning tree is configured because it has the advantage of being able to secure a detour route in the event of a failure.

 As for STP, there are multiple types of STP, IEEE802.1D and IEEE802.1W. The current mainstream is IEEE802.1W, commonly known as RSTP (Rapid Spanning Tree Protocol).

5 state transitions

In STP, there are 5 states as shown below, so a maximum communication interruption of 50 seconds (20 seconds + 15 seconds + 15 seconds) will occur.

・Disabled
 ↓ (Port is administratively shut down)
・Blocking
 ↓ (Maximum elapsed time 20 seconds)
・Listening
 ↓ (Transfer delay 15 seconds)
・Learning
 ↓ (Transfer delay 15 seconds)
・Forwarding

 During that time, communication will not be possible, so it is not very suitable for mission-critical environments. Therefore, RSTP was developed to overcome this weakness of STP.

 With RSTP, spanning tree recomputation is very fast, in the order of 1 second. RSTP is compatible with STP (IEEE802.1d), so it can operate in a mixed environment with STP.

Here, we will try to build a network using IEEE802.1D (STP).

 Regarding the operation of STP, when the power is turned on, BPDU is sent with the bridge ID (BID), and the root bridge is first elected. By the way, in Cisco equipment, the transmission interval is 2 seconds by default.

At STP, the following elections take place:

  • One root bridge per network
  • One root port per non-root bridge switch
  • One representative port per segment
  • Determining Which Ports to Block

 Root ports and designated ports are used to forward data traffic. A blocking port only receives BPDUs, discards data frames, and never learns addresses.

Election of root bridge

 All switches receive and confirm BPDUs, and finally the bridge with the lowest BID value is elected as the root bridge.

● Selection of Root Port

 Each non-root switch elects one port as the root port. The path with the lowest cost to the root bridge becomes the root port providing the best path.

● Selection of Designated Port

 Select ports to participate in spanning tree. Again, the path with the lowest cost to the root bridge becomes the designated port that provides the best path.

● Determining blocking ports

The remaining ports that are not RP (Root Port) or DP (Designated Port) are blocking ports.

The following values ​​are used in path cost calculations for RP and DP elections:

<Port pass cost value>

bandwidthnew costold cost
10Mbps100100
100Mbps19Ten
1 GbpsFour1
10Gbps21

 When configuring with new or old equipment, or when configuring between different models, new costs and old costs are mixed, so it may be necessary to customize costs for each equipment.