Command Line Reference
Ethernet Switching
STP Configuration
23 min
show stp mstp show stp mstp \[command] show stp mstp \[purpose] view spanning tree status \[view] system view \[use cases] sonic# show stp mstp show stp stpid show stp stpid \[command] show stp stpid stp id \[purpose] view spanning tree status of interfaces under the specified stp instance \[view] system view \[use cases] sonic# show stp stpid 1 show stp stpid show stp stpid \[command] show stp stpid \[{etherne |ink aggregation} interface name ] \[purpose] view the spanning tree status of a specific interface in a particular stp instance \[view] system view \[use cases] sonic# show stp stpid 1 ethernet 5 show stp bind show stp bind \[command] show stp mstp \[purpose] check the binding relationship between the specified stp instance and the vlan \[view] system view \[usage scenario] after configuring the mapping between instances and vlans on the device, you can execute this command to view the mapping by default, all vlans are bound to instance 0 unless mapped separately \[use cases] sonic# show stp bind stp enable mstp stp enable mstp \[command] stp enable mstp no stp enable mstp \[purpose] enable mstp mode \[view] system configuration view \[usage scenario] in complex layer 2 networks, in order to prevent loops or break loops, the spanning tree protocol (stp) can be deployed on switching devices the role of mstp is to prevent packets from continuously circulating and looping in a circular network, thereby avoiding performance degradation caused by devices repeatedly receiving the same packets mstp works by selecting the best path and blocking the remaining paths to ensure that there are no redundant paths and loops in the network this improves network reliability and stability \[use cases] sonic(config)# stp enable mstp stp bind vlan stp bind vlan \[command] stp bind vlan vlan id stp id no stp bind vlan \[purpose] bind vlan with stp instances \[parameter] parameter description vlan id vlan id, the range of value 1 4094 stp id stp id, the range of value 0 255 \[view] system configuration view \[usage scenario] after allowing the stp enabled switching device to start up normally, the stp related configuration for the current vlan defaults to stp instance with id 0 if you need to achieve business isolation for various access vlans through multiple processes, you can use this command to add the vlan where the access link is located to a specified stp instance \[use cases] sonic(config)# stp bind vlan 400 1 stp forward delay stp forward delay \[command] stp forward delay time \[purpose] configure the forward delay time of the device \[parameter] parameter description time value range 4 30, unit s \[view] system configuration view \[usage scenario] when the network topology changes, due to the time it takes for new bpdu configuration messages to propagate throughout the network, ports that should have been blocked may not have been blocked in time, and previously blocked ports should no longer be blocked this can potentially create a temporary loop to avoid temporary loops caused by this situation, you can configure the forward delay timer to set a delay period, during which all ports will be temporarily blocked \[notes] the port is temporarily blocked during the delay time set by the forward delay timer when configuring the hello time, forward delay and max age values, the configured values should satisfy the following relationships to ensure that the spanning tree algorithm of the entire network works effectively, otherwise the network will frequently oscillate 2 × (forward delay -1 0 s) ≥ max age max age ≥ 2 × (hello time + 1 0 s) \[use cases] sonic(config)# stp forward delay 5 stp hello stp hello \[command] stp hello time \[purpose] configure the time interval for the device to send bpdus \[parameter] parameter description time value range 1 10, unit s \[view] system configuration view \[usage scenario] in a network running spanning tree protocol (stp), switches periodically send bridge protocol data units (bpdus) to other devices in the same spanning tree to maintain the stability of the spanning tree by executing this command, user can set the interval for sending bpdus to maintain the stability of the network's topology \[use cases] sonic(config)# stp hello 5 stp max age stp max age \[command] stp max age time \[purpose] specify the aging time of bpdus on the device \[parameter] parameter description time value range 10 1000000, unit s \[view] system configuration view \[notes] the device will determine whether the bpdu received from the upstream device times out based on the max age time of the port if the bpdu times out, the device will age out the bpdu and block the port receiving the bpdu at the same time, and issue the bpdu with itself as the root bridge \[use cases] sonic(config)# stp max age 20 stp instance stp instance \[command] stp instance id no stp instance id \[purpose] create stp instances \[parameter] parameter description id value range 1 255 \[view] system configuration view \[usage scenario] mstp divides a switched network into multiple domains, each forming multiple spanning trees within the domain the spanning trees are independent of each other as long as two switches have the same mstp domain name and the same mapping between spanning trees and vlans, they belong to the same domain \[use cases] sonic(config)# stp instance 1 sonic(config stp 1)# stp name stp name \[command] stp name \[purpose] configure the stp instance name \[view] system configuration view \[usage scenario] mstp divides a switched network into multiple domains, each forming multiple spanning trees within the domain the spanning trees are independent of each other as long as two switches have the same mstp domain name and the same mapping between spanning trees and vlans, they belong to the same domain \[use cases] sonic(config)# stp name test port priority port priority \[command] port id priority value \[purpose] configure the priority of the interface in the spanning tree calculation \[parameter] parameter description value value range 0 15 \[view] stp view \[usage scenario] for switch device ports, the size of their port priority identifier (pid) may affect whether they are elected as designated ports during the spanning tree calculation, ports with smaller pids will be elected as designated ports \[notes] when port priority changes, the spanning tree will recompute the port roles and perform state transitions \[use cases] sonic(config)# stp instance 1 sonic(config stp 1)# port 1 priority 3 priority priority \[command] priority value \[purpose] configure the priority of the device in the specified instance \[parameter] parameter description value value range 0 15 \[view] stp view \[notes] the priority of a device is a crucial factor in the spanning tree calculation, and the priority of a switch device can impact the election of the root bridge a device with a lower priority value has a higher likelihood of being elected as the root bridge \[use cases] sonic(config)# stp instance 1 sonic(config stp 1)# priority 3 link aggregation priority link aggregation priority \[command] link aggregation id priority value \[purpose] configure the priority of the lag port in the specified instance \[parameter] parameter description value value range 0 15 \[use cases] sonic(config)# stp instance 0 sonic(config stp 0)# link aggregation 1 priority 3 stp bpdu filter enable stp bpdu filter enable \[command] stp bpdu filter enable no stp bpdu filter enable \[purpose] configure the current port as a bpdu filter port \[view] interface view \[usage scenario] in a layer 2 network running the spanning tree protocol, ports connected to end devices do not need to participate in the spanning tree calculation involving these ports in the calculation can affect the convergence speed of the network topology configure this command on edge devices to make edge ports not process or send bpdu packets this port will then be a bpdu filter port \[use cases] sonic(config)# interface ethernet 1 sonic(config if 1)# stp bpdu filter enable stp bpdu guard enable stp bpdu guard enable \[command] stp bpdu guard enable no stp bpdu guard enable \[purpose] configure edge port protection \[view] interface view \[usage scenario] in layer 2 networks running spanning tree protocol, ports connected to end user devices don't need to participate in spanning tree calculations their participation can slow down network topology convergence when malicious users send malicious bpdu (bridge protocol data unit) packets as part of an attack, it can cause network instability and disrupt user traffic by configuring bpdu protection on edge ports, if an edge port receives a bpdu packet, the port will be forcibly shut down \[notes] after an interface is shut down due to receiving a bpdu, user need to manually execute the no shutdown command to restore it \[use cases] sonic(config)# interface ethernet 1 sonic(config if 1)# stp bpdu guard enable
