Configuration Guide
Ethernet Switch Configuration
MSTP Configuration
25 min
introduction introduction mstp (multiple spanning tree protocol) is a protocol for creating multiple spanning trees based on stp/rstp introduced in ieee 802 1s, it binds multiple stp instances to a smaller set of vlans mstp inherits all the advantages of stp/rstp while addressing the issue of link underutilization by forming multiple loop free trees, mstp resolves broadcast storms and provides redundancy the multiple trees achieve load balancing between vlans, directing traffic along different paths for different vlans explanation of principles explanation of principles the principles and calculation methods of mstp closely resemble those of stp/rstp the fundamental idea is to establish a loop free tree structure by prioritizing comparisons, connecting devices from the highest priority root node to lower priority ones this process transforms a cyclic network into a loop free tree structure the following diagram illustrates this concept mstp region mstp region unlike stp/rstp, mstp introduces the concept of regions, which divides the entire network into different regions composed of multiple switches and the segments between them devices within the same mstp region share the following characteristics all devices in the region run mstp all devices have same region name all devices share the same vlan to spanning tree instance mapping configuration all devices share the same mstp revision level configuration a local area network can have multiple mstp regions, and these regions can be directly or indirectly connected physically users can utilize mstp configuration commands to group multiple switches into the same mstp region by configuring, three regions (region1 to region3) are formed as shown in the diagram in mstp, instance 0 has a special significance known as cisti (common and internal spanning tree instance), while the remaining instances are referred to as mstis (multiple spanning tree instances) by default, all vlans are bound to the cisti, ensuring the security of the entire network the cist (common and internal spanning tree) is calculated using the stp or rstp protocol and forms a single spanning tree that connects all switching devices within a network the ist (internal spanning tree) of all mst regions combined with the cst (common spanning tree) forms a complete spanning tree known as cist within each region, it acts as ist, pruning devices to create a spanning tree; between regions, it acts as cst, treating each region as a single node and pruning them to form a spanning tree the resulting effects are illustrated in the diagram cist prunes the circular network into a tree within each domain and trims the entire network into a loop free tree across domains due to the introduction of domains and instances, mstp has two types of root nodes the common and internal spanning tree instance (cist) root and the domain root the cist root is a global concept and there is only one cist root for all interconnected stp/rstp/mstp devices it is also the root of the cist the domain root, on the other hand, is specific to a particular domain and instance it is a localized concept and is also the root of instance0 in region1 mstp topology calculation principle mstp topology calculation principle mstp divides the entire network into multiple mst domains, treating each domain as a node the calculations between different mst domains are performed using the stp or rstp protocol algorithms to generate the common spanning tree (cst), which is a single spanning tree the calculation of the mstp vector priority is as follows priority vector name description root bridge id the root bridge id is used to select the root bridge in the common and internal spanning tree (cist) it corresponds to the bridge id in the bpdu and is calculated using the formula priority (16 bits) + mac (48 bits) external root path cost (erpc) the path cost from an mst domain root to the overall root the external root path cost stored on all switches within the mst domain is the same if the cist root bridge is within the domain, the external root path cost stored on all switches in the domain is 0 domain root id also known as the msti tree root, the domain root id is used to select the root of the multiple spanning tree instances (mstis) it's also elected based on the bridge id and is calculated using the formula priority (16 bits) + mac (48 bits) internal root path cost (irpc) the path cost from the local switch to the domain root bridge edge ports of the domain have a higher internal root path cost value (lower priority) compared to non edge ports designated bridge the designated bridge for the cist or an msti instance is the nearest upstream switch to the local switch on the path to the domain root if the local switch is the overall root or domain root, the designated bridge is itself designated port the designated port is the port on the designated bridge that is connected to the local switch's root port its port id = priority (8 bits) + port number (8 bits) receiving port the receiving port is the port that receives the bpdu messages and its port priority must be a multiple of 16 its port id = priority (8 bits) + port number (8 bits) port priority must be a multiple of 16 the lowest vector has the highest priority, and the comparison rules are as follows first, compare the root bridge id if the root bridge ids are the same, proceed to compare the external root path cost if the external root path costs are also the same, then compare the domain root ids if the domain root ids are still the same, proceed to compare the internal root path costs if the internal root path costs are still the same, then compare the designated bridge ids if the designated bridge ids are still the same, proceed to compare the designated port ids if the designated port ids are still the same, then compare the receiving port ids csti calculation after the configuration message exchange comparison, select the switch with the highest priority as the root of the cist in the entire network then, within each mst domain, calculate the ist (internal spanning tree) using the mstp protocol algorithm at the same time, mstp treats each mst domain as a single switch and calculates the cst (common spanning tree) between mst domains using the stp or rstp protocol algorithm the cst and ist together form the cist for the entire switch network msti calculation within an mst domain, mstp generates different spanning tree instances (mstis) for different vlans based on the mapping between vlans and instances the characteristics of msti calculation are as follows each msti independently calculates its own spanning tree without interfering with others the calculation method for the spanning tree in each msti is similar to rstp each msti can have its own root and topology each msti sends its own bpdu within its own spanning tree the topology of each msti is determined through configuration commands (not automatically generated) the parameters for each port in different mstis can be different the role and status of each port in different mstis can also be different msti spanning tree algorithm implementation at the beginning, each switch's ports generate configuration messages with itself as the root bridge these messages have a root path cost of 0, the specified bridge id as its own switch id, and the specified port as the current port each switch sends out its own configuration message and processes other configuration messages it receives as follows when a port receives a configuration message with a lower priority than its own (priority comparison is based on the vector priority comparison rules explained earlier), the switch discards the received configuration message and takes no action on the configuration message for that port when a port receives a configuration message with a higher priority than its own, the switch replaces the content of the received configuration message with the content of the port's own configuration message then, the switch compares this port's configuration message with the configuration messages on its other ports and selects the optimal configuration message spanning tree calculation steps root bridge election by comparing the root bridge ids in the configuration messages sent by all switches, the switch with the smallest root bridge id becomes the cist root bridge or mst domain root bridge root port election on non root bridges each non root bridge designates the port that receives the best configuration message as its root port designated port election this step consists of the following two sub steps switch calculates a standardized designated port configuration message for each port based on the root port's configuration message and root port's path cost it replaces the root bridge id with the root port's configuration message root bridge id, adds the root port's path cost to the root port's configuration message root path cost, replaces the designated bridge id with its own switch id, and replaces the designated port id with its own port id switch compares the calculated configuration message from the above rule with the original configuration message on the corresponding port if the original configuration message is better, the port is blocked, and its configuration message remains unchanged the port will only receive configuration messages but not forward data (acting as a root port) if the calculated configuration message is better, the switch designates the port as the designated port, replaces the port's configuration message with the calculated one, and periodically sends it out after the msti spanning tree topology convergence, regardless of whether non root bridges receive messages from the root bridge, they periodically send bpdus according to the hello timer if a port does not receive a bpdu from the designated bridge (the higher level switch it is connected to) for 3 consecutive hello times (default setting), the switch considers the link to that neighbor as failed mstp configuration mstp configuration default configuration default configuration parameter default value spanning tree protocol working mode mstp mode mstp function global mstp function is not enabled, port level mstp function is not enabled instance priority 8 port priority 8 forward delay time 15 seconds hello time 2 seconds max age time 20 seconds mstp working mode configuration mstp working mode configuration operation command description enter the system configuration view configure terminal enable mstp stp enable mstp mstp attribute configuration mstp attribute configuration operation command description enter the system configuration view configure terminal configure mstp forward delay mstp forward delay time range value 4 30 seconds configure mstp hello packet interval mstp hello time range value 1 10 seconds configure mstp aging time mstp max age time range value 1 1000000 seconds configure mstp domain mstp name name mstp instance configuration mstp instance configuration operation command description enter the system configuration view configure terminal create an mstp instance and enter the instance configuration mode mstp instance instance id bind a vlan to the instance stp bind vlan instance id vlan id configure the instance priority priority num range value 0 15 configure port priority within the instance interface priority num interface \[ ethernet | link aggregation ] name range value 0 15 display and maintenance display and maintenance operation command description display mstp information show mstp configuration example configuration example network requirements network requirements all devices in the network belong to the same mst domain, and by configuring mstp, messages from different vlans are forwarded according to different mstis procedure procedure device 1 configuraion \# create vlan 40, 41, and add the interface to the vlan sonic(config)# vlan 40 sonic(config)# vlan 41 sonic(config)# interface ethernet 1 sonic(config if 1)# switchport trunk vlan 40 sonic(config if 1)# switchport trunk vlan 41 sonic(config)# interface ethernet 2 sonic(config if 2)# switchport trunk vlan 40 sonic(config if 2)# switchport trunk vlan 41 \# enable mstp function and configure the domain name of mst domain as test sonic(config)# stp enable mstp sonic(config)# stp name test \# configure msti instance and configure the instance priority of this device sonic(config)# stp instance 40 sonic(config stp 40)# priority 1 sonic(config)# stp instance 41 sonic(config stp 41)# priority 5 \# bind vlan and msti instance sonic(config)# stp bind vlan 40 40 sonic(config)# stp bind vlan 41 41 device 2 configuration \# create vlan 40, 41, and add the interface to the vlan sonic(config)# vlan 40 sonic(config)# vlan 41 sonic(config)# interface ethernet 1 sonic(config if 1)# switchport trunk vlan 40 sonic(config if 1)# switchport trunk vlan 41 sonic(config)# interface ethernet 2 sonic(config if 2)# switchport trunk vlan 40 sonic(config if 2)# switchport trunk vlan 41 \# enable mstp function and configure the domain name of mst domain as test sonic(config)# stp enable mstp sonic(config)# stp name test \# configure msti instance and configure the instance priority of this device sonic(config)# stp instance 40 sonic(config stp 40)# priority 5 sonic(config)# stp instance 41 sonic(config stp 41)# priority 5 \# bind vlan and msti instance sonic(config)# stp bind vlan 40 40 sonic(config)# stp bind vlan 41 41 device 3 configuration \# create vlan 40, 41, and add the interface to the vlan sonic(config)# vlan 40 sonic(config)# vlan 41 sonic(config)# interface ethernet 1 sonic(config if 1)# switchport trunk vlan 40 sonic(config if 1)# switchport trunk vlan 41 sonic(config)# interface ethernet 2 sonic(config if 2)# switchport trunk vlan 40 sonic(config if 2)# switchport trunk vlan 41 \# enable mstp function and configure the domain name of mst domain as test sonic(config)# stp enable mstp sonic(config)# stp name test \# configure msti instance and configure the instance priority of this device sonic(config)# stp instance 40 sonic(config stp 40)# priority 5 sonic(config)# stp instance 41 sonic(config stp 41)# priority 1 \# bind vlan and msti instance sonic(config)# stp bind vlan 40 40 sonic(config)# stp bind vlan 41 41 verify configuration verify configuration view spanning tree information on device 1 sonic# show stp mstp spanning tree mode mstp vlan mst instance port role state \ vlan40 40 ethernet1(desg)(forw) ethernet2(desg)(forw) vlan41 41 ethernet1(desg)(forw) ethernet2(root)(forw) view spanning tree information on device 2 sonic# show stp mstp spanning tree mode mstp vlan mst instance port role state \ vlan40 40 ethernet1(altn)(disc) ethernet2(root)(forw) vlan41 41 ethernet1(root)(forw) ethernet2(altn)(disc) view spanning tree information on device 3 sonic# show stp mstp spanning tree mode mstp vlan mst instance port role state \ vlan40 40 ethernet2(root)(forw) ethernet1(desg)(forw) vlan41 41 ethernet2(desg)(forw) ethernet1(desg)(forw)
