Tutorials · Switching
How to Prevent Network Loops With Spanning Tree (RSTP)
Stop broadcast storms caused by loops: enable RSTP, choose the root bridge, and protect edge ports with BPDU guard.
Before you start
- Managed switches supporting 802.1w RSTP or 802.1s MSTP
Step by step
Enable RSTP everywhere
Use the same mode on every switch.
spanning-tree mode rstpMake the core switch the root
Set the lowest priority on the core so the topology is predictable.
spanning-tree priority 4096Mark edge ports
Ports to PCs, phones and cameras should start forwarding immediately.
interface range gigabitEthernet 0/1-24 spanning-tree portfast
Enable BPDU guard
If someone plugs a switch into a user port, the port shuts down instead of creating a loop.
interface range gigabitEthernet 0/1-24 spanning-tree bpduguard enable
Verify
Check the root bridge and port roles.
show spanning-tree
Commands are generic, industry-standard examples. Exact syntax and menu names vary by model and firmware; check your device's manual on the Documentation page.
Pro tips
- Enable storm control on access ports as a second layer of protection.
- For rings of industrial switches, ERPS recovers faster than RSTP.
FAQ
Frequently asked questions
Why is my network slow after someone connected a cable?
A loop without spanning tree causes a broadcast storm. Enable RSTP and BPDU guard to prevent it.
Keep learning
Related guides
ERPS ring protection
Read more →How to Configure VLANs on a Managed Switch
Separate staff, guests, voice and cameras into their own VLANs: create VLANs, set access and trunk ports, and verify traffic separation.
Read more →How to Set Up Inter-VLAN Routing on a Layer 3 Switch
Route between VLANs at wire speed using switch virtual interfaces (SVIs), a DHCP relay and ACLs that control which networks can talk.
Read more →How to Configure Link Aggregation (LACP) Between Switches
Bundle two or more links into one logical link for more bandwidth and redundancy using IEEE 802.3ad LACP.
Read more →Stuck on a step?
Ask Navijin technical support or an authorised partner for help with your configuration.