What is Spanning Tree Protocol (STP)?

A protocol (IEEE 802.1D) that, in a network where switches are connected with redundant paths, logically blocks some ports so that the paths form a loop-free tree, preventing broadcast storms. If a path in use fails, it switches over by using a port that was blocked. RSTP (Rapid Spanning Tree Protocol) is an improved version that switches over faster.

Japanese name: スパニングツリープロトコル(STP)

Spanning Tree Protocol (STP) appears in 5 practice questions across 1 topic, including Network Design and Operations.

Field: Network Design and Operations

Why loops are a problem

Ethernet frames have no mechanism like the IP TTL that counts hops and discards the frame. If switches are connected in a loop, broadcasts and frames to unknown destinations keep circulating, multiplying every time a switch floods them (a broadcast storm). Frames from the same source also arrive on different ports, which disrupts MAC address learning. At the same time, paths should be redundant so that the failure of one link or switch does not stop communication, so STP is used to break the loop logically while the physical loop remains.

The root bridge and port roles

In STP, the switches exchange messages called BPDUs and first elect as the root bridge the switch with the lowest bridge ID (priority plus MAC address). Every other switch makes the port with the lowest path cost to the root bridge its root port. On each link, the port on the side closer to the root bridge becomes the designated port, and ports that are neither root ports nor designated ports are blocked. Faster links have lower path costs, and ties are broken by comparing bridge IDs and similar values.

RSTP and multiple VLANs

Classic STP moves ports to the forwarding state while waiting on timers, so switching over after a failure took about 30 to 50 seconds. RSTP (created as IEEE 802.1w and later merged into 802.1D) uses a proposal-and-agreement exchange between neighboring switches and alternate ports chosen in advance, and in many cases switches over within a few seconds. MSTP (Multiple Spanning Tree), which can build a separate tree for each group of VLANs, lets different VLANs use different links so that redundant links are also put to work.

Try it: questions about Spanning Tree Protocol (STP)

In a network where switches are connected with redundant paths, what role does the Spanning Tree Protocol (STP) play?

  1. AIt logically disables some ports so that the paths form a loop-free tree, preventing broadcast frames from circulating endlessly
  2. BIt spreads frames evenly over several links between switches to increase bandwidth
  3. CIt relays frames between different VLANs so that the VLANs can communicate with each other
Show answer and explanation

Answer: A. It logically disables some ports so that the paths form a loop-free tree, preventing broadcast frames from circulating endlessly

If switches are connected in a loop, broadcasts and frames to unknown destinations keep circulating and multiplying around the loop (a broadcast storm), and the network stops working. This happens because Ethernet frames have no mechanism like the IP TTL that counts hops and discards the frame. STP has the switches exchange messages called BPDUs and blocks some ports so that the active paths form a tree rooted at the root bridge. If a link in use fails, it moves a blocked port to the forwarding state to switch to another path.

In STP, the bridge IDs of three switches are known: SW1 has priority 32768 and MAC address 00-00-5E-00-53-01, SW2 has priority 61440 and MAC address 00-00-5E-00-53-05, and SW3 has priority 4096 and MAC address 00-00-5E-00-53-0A. Which switch is elected as the root bridge?

  1. ASW1
  2. BSW2
  3. CSW3
Show answer and explanation

Answer: C. SW3

In STP, the switch with the lowest bridge ID becomes the root bridge. The bridge ID puts the priority in the upper part and the MAC address in the lower part, so priorities are compared first and MAC addresses only when the priorities are equal. Here SW3, with the lowest priority of 4096, becomes the root bridge regardless of its MAC address. The default priority is 32768, and if nothing is configured the switch with the lowest MAC address is chosen, so it is common practice to give the switch at the center of the network a lower priority.

FAQ

With STP, is there no need to worry about loops?

STP prevents loops formed between switches that exchange BPDUs, but not loops formed through ports where STP is disabled or through equipment that does not handle BPDUs. It is common to combine it with a feature that shuts down an edge port when it receives a BPDU and with limits on the amount of broadcast traffic.

Aren't the links blocked by STP wasted?

With a single tree, blocked links are on standby and normally carry no traffic. To use their bandwidth as well, networks use link aggregation, which bundles several links into one (STP sees it as a single link), MSTP, which builds a separate tree per VLAN group, or designs that route at layer 3.

Spanning Tree Protocol (STP) in the explanations

Questions that mention Spanning Tree Protocol (STP) (5)

  1. In a network where switches are connected with redundant paths, what role does the Spanning Tree Protocol (STP) play?
  2. In STP, the bridge IDs of three switches are known: SW1 has priority 32768 and MAC address 00-00-5E-00-53-01, SW2 has priority 61440 and MAC address 00-00-5E-00-53-05, and SW3 has priority 4096 and MAC address 00-00-5E-00-53-0A. Which switch is elected as the root bridge?
  3. Three switches, SW1, SW2 and SW3, are connected in a triangle with one link between each pair. The STP root bridge is SW1, and SW2 has a lower bridge ID than SW3. All links have the same path cost. Which port is blocked (does not forward frames)?
  4. With default timers, classic STP (IEEE 802.1D) takes about 30 to 50 seconds after a failure before a previously blocked port starts forwarding. Which mechanism lets RSTP switch over faster?
  5. Four 1 Gbps links between two switches are bundled into one logical link with link aggregation. Frames are distributed with the common method that chooses the link for each combination of source and destination addresses and port numbers (each flow). Which is closest to the maximum throughput a single TCP connection can achieve?

Books on Network Design and Operations Ad

As an Amazon Associate I earn from qualifying purchases.

Comparisons that include this term

Related terms

Ethernet IP (Internet Protocol) MAC address Link aggregation Throughput TCP (Transmission Control Protocol) ACL (access control list) Administrative distance BGP (Border Gateway Protocol) Broadcast domain

Back to the glossary