What is STP (Spanning Tree Protocol)?
Why Interviewers Ask This
Candidates at the intermediate level are expected to not only know this concept but explain the trade-offs involved. Interviewers use this question to see if you can reason about design decisions, not just recall facts.
Answer
STP (Spanning Tree Protocol, IEEE 802.1D) prevents switching loops in networks with redundant paths between switches. Without STP, a loop would cause broadcast storms (packets circulating endlessly), rapidly consuming all bandwidth and crashing the network. STP works by electing a Root Bridge (the switch with the lowest Bridge ID = priority + MAC address). From the Root Bridge, STP calculates the shortest path to every other switch and blocks redundant paths by placing specific ports in Blocking state. Active ports are in Forwarding state; ports transition through Listening and Learning states during convergence. RSTP (Rapid STP, 802.1w) converges in seconds instead of up to 50 seconds for STP. MSTP (Multiple STP) creates separate spanning tree instances per VLAN group. Modern networks often use RSTP with portfast/BPDU guard for faster convergence on edge ports.
Pro Tip
If you're unsure about a detail, say so honestly and explain your reasoning. Interviewers respect candidates who can think through uncertainty rather than bluffing.