跳转到内容
Ask AI

STP Configuration

此内容尚不支持你的语言。

[Command] show stp mstp

[Purpose] View spanning tree status

[View] System view

[Use Cases]

sonic# show stp mstp

[Command] show stp stpidstp-instance-id

[Purpose] View spanning tree status of interfaces under the specified STP instance

[View] System view

[Use Cases]

sonic# show stp stpid 1
Section titled “show stp stpid stp-instance-id [ethernet ethernet-id | link-aggregation”

[Command] show stp stpidstp-instance-id**[ethernetethernet-id| link-aggregationlag-id]**

[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

[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

[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

[Command] stp bind vlanvlan-id stp-id no stp bind vlanvlan-id

[Purpose] Bind VLAN with STP instances

[Parameter]

ParameterDescription
vlan-idVLAN ID, the range of value: 1-4094
stp-idSTP 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

[Command] stp forward-delaytime

[Purpose] Configure the forward delay time of the device

[Parameter]

ParameterDescription
timeValue 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

[Command] stp hellotime

[Purpose] Configure the time interval for the device to send BPDUs

[Parameter]

ParameterDescription
timeValue 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

[Command] stp max agetime

[Purpose] Specify the aging time of BPDUs on the device

[Parameter]

ParameterDescription
timeValue 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

[Command] stp instanceid no stp instanceid

[Purpose] Create STP instances

[Parameter]

ParameterDescription
idValue 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)#

[Command] stp namename

[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

[Command] portinterface-namepriorityvalue

[Purpose] Configure the priority of the interface in the spanning tree calculation

[Parameter]

ParameterDescription
valueValue 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

[Command] priorityvalue

[Purpose] Configure the priority of the device in the specified instance

[Parameter]

ParameterDescription
valueValue 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

[Command] link-aggregationidpriorityvalue

[Purpose] Configure the priority of the LAG port in the specified instance.

[Parameter]

ParameterDescription
valueValue range: 0-15

[Use Cases]

sonic(config)# stp instance 0
sonic(config-stp-0)# link-aggregation 1 priority 3

[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

[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