Enable Spanning Tree
Enable spanning tree on the switch, set the priority and force the version to Rapid Spanning Tree (RSTP)
spanning-tree priority 0
spanning-tree force-version RSTP-operation
BPDU Filtering and BPDU Protection
The port will ignore BPDUs and stay locked in the “forwarding state” if another switch was inadvertently plugged into the port
spanning-tree 1-24 bpdu-filter
Disable the port(s) if a BPDU is received when a device that supports spanning tree such as another switch is plugged into the port
spanning-tree 1-24 bpdu-protection
By default “auto-edge” is enabled on all ports, this will look for BPDUs for 3 seconds and if none found will begin forwarding packets and the port is set as “edge”, if there are BPDUs the port is set as “non-edge”. The ports can be configured manually by using the “admin-edge-port” command, this will override “auto-edge”. End devices such as PCS, Laptops, Printers etc should be defined as an “Edge Port” and up-links/inter-switch links should be set as “non-edge ports”.
Manually configures the port(s) as an edge port on ports connected to end devices
spanning-tree 1-48 admin-edge-port
Manually configures the uplink/inter-switch ports as “non-edge”
no spanning-tree 49-50 admin-edge-port
Configure loop protection to prevent accidental loops if an unmanaged device that does not support spanning tree is plugged into the edge-port.
loop-protect trap loop-detected