Spanning Tree Protocol (STP) protects Layer 2 broadcast domains from broadcast storms by selectively setting links to standby mode to prevent loops. In standby mode, these links temporarily stop transferring user data. After the topology changes, so that the data transfer is made possible, the links are automatically re-activated.
Network Loops occur when there are alternate routes between hosts. These loops cause Layer 2 switches to forward traffic across the network infinitely, reducing network efficiency. STP provides a unique path between endpoints on a network. These paths eliminate the possibility of network loops. STP is typically configured when there are redundant links to a host to prevent network loop.
The device supports the following Spanning Tree Protocol versions:
MSTP solves this problem by enabling several STP instances, so that it is possible to detect and mitigate loops separately in each instance. This enables a port to be blocked for one or more STP instances but non-blocked for other STP instances. If different VLANs are associated with different STP instances, then their traffic will be relayed based on the STP port state of their associated MST instances. This results to better bandwidth utilization.
This article aims to show you how to configure STP on a CBW switch through the CLI.
Step 1. Log in to the switch console. The default username and password is cisco/cisco. If you have configured a new username or password, enter the credentials instead.
Note: To learn how to access an SMB switch CLI through SSH or Telnet, click here.
Note: The commands may vary depending on the exact model of your switch.
Step 2. From the Privileged EXEC mode of the switch, enter the Global Configuration mode by entering the following:
CBS350#configureStep 3. To enable the STP functionality on the switch, enter the following:
CBS350(config)#spanning-treeStep 4. To configure the STP protocol to run on the switch, enter the following:
CBS350(config)#spanning-tree mode [stp|rstp|mst]The options are:
In this example, rstp is used.
CBS350(config)#spanning-tree mode rstpStep 5. To set the default path cost method, enter the following:
CBS350(config)#spanning-tree pathcost method [long|short]The options are:
In this example, long is selected.
CBS350(config)#spanning-tree pathcost method longStep 6. To configure the switch STP priority, which is used to determine which bridge is selected as the root bridge, enter the following:
CBS350(config)#spanning-tree priority [priority-number]In this example, 32768 is used.
CBS350(config)#spanning-tree priority 32768Step 7. (Optional) To configure how often the switch broadcasts Hello messages to other devices, enter the following:
In this example, 32768 is used.
In this example, the default Hello time of 2 seconds is used.
CBS350(config)#spanning-tree hello-time 2Step 8. (Optional) To configure the STP maximum age, enter the following:
CBS350(config)#spanning-tree max-age [seconds]In this example, the default value of 20 seconds is used.
CBS350(config)#spanning-tree max-age 20Step 9. (Optional) To configure the STP bridge forward time, which is the amount of time a port remains in the listening and learning states before entering the forwarding state, enter the following:
CBS350(config)#spanning-tree forward-time [seconds]In this example, the default value of 15 seconds is used.
CBS350(config)#spanning-tree forward-time 15Step 10. (Optional) To enable STP Loopback Guard, enter the following:
CBS350(config)#spanning-tree loopback-guardNote: Enabling this feature checks if a root port or an alternate root port receives Bridge Protocol Data Units (BPDUs).
Step 11. Enter the exit command to go back to the Privileged EXEC mode:
CBS350(config)#exitStep 12. (Optional) To display the STP settings on the switch, enter the following:
CBS350#show spanning-treeStep 13. (Optional) In the Privileged EXEC mode of the switch, save the configured settings to the startup configuration file by entering the following:
CBS350#copy running-config startup-configStep 14. (Optional) Press Y for Yes or N for No on your keyboard once the Overwrite file [startup-config]… prompt appears.
You should now have successfully configured the STP settings on your switch through the CLI.