Additional Spanning Tree Protocol (STP) commands such as BPDU Protection, BPDU Filtering, Admin-Edge and Loop Protection exist to enhance implementations of STP and ensure a loop free network.
Enable Spanning Tree
spanning-tree priority 0
spanning-tree force-version RSTP-operation
# Enable spanning tree on the switch, set the priority and force the version to Rapid Spanning Tree (RSTP)
BPDU Filtering and BPDU Protection
spanning-tree 1-24 bpdu-filter
# 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-protection
# 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
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 uplinks/inter-switch links should be set as “non-edge ports”.
spanning-tree 1-48 admin-edge-port
# Manually configures the port(s) as an edge port on ports connected to end devices
no spanning-tree 49-50 admin-edge-port
# Manually configures the uplink/inter-switch ports as “non-edge”
loop-protect trap loop-detected
# Configure loop protection to prevent accidental loops if an unmanaged device that does not support spanning tree is plugged into the edge-port.