Spanning tree protocol (STP) cannot enable
Ethernet ports to transit their states rapidly. It costs two times of the
forward delay for a port to turn to the forwarding state even if the port is on
a point-to-point link or the port is an edge port.
Rapid spanning tree protocol (RSTP) enables
the spanning tree to converge rapidly, but it suffers from the same drawback as
STP: all bridges in a LAN share one spanning tree; packets of all VLANs are
forwarded along the same spanning tree, and therefore redundant links cannot be
blocked based on VLANs.
As well as the two protocols above, multiple
spanning tree protocol (MSTP) can disbranch a ring network to form a tree-topological
ring-free network to prevent packets from being duplicated and forwarded
endlessly in the ring network. Additionally, MSTP can also provide multiple
redundant paths for packet forwarding to implement VLAN-based load balancing.
MSTP is compatible with both STP and RSTP.
It overcomes the drawback of STP and RSTP. It not only enables spanning trees
to converge rapidly, but also enables packets of different VLANs to be
forwarded along their respective paths to provide a better load balancing
mechanism for redundant links.
Bridge protocol data unit (BPDU), which is
also called configuration message, is the protocol data unit (PDU) that STP and
RSTP use.
The switches in a network transfer BPDUs
between each other to determine the topology of the network. BPDUs carry enough
information needed for spanning tree calculation.
BPDUs used in STP fall into the following
two categories:
l
Configuration BPDUs: BPDUs of this type are used
to maintain the spanning tree topology.
l
Topology change notification BPDU (TCN BPDN): BPDUs
of this type are used to notify the switches of network changes.
Similar to STP and RSTP, MSTP uses BPDUs for
spanning tree calculation too. Besides, the BPDUs of MSTP carry MSTP
configuration information of the switches.
Figure
1-1 illustrates basic MSTP terms (assuming that MSTP is enabled on each
switch in this figure).

Figure 1-1 Basic MSTP terminologies
I. MST region
A multiple spanning tree region (MST region)
comprises multiple physically-interconnected MSTP-enabled switches and the
corresponding network segments connected to these switches. These switches have
the same region name, the same VLAN-to-MSTI mapping configuration and the same MSTP
revision level.
A switched network can contain multiple MST
regions. You can group multiple switches into one MST region by using the
corresponding MSTP configuration commands. For example, all switches in region
A0 shown in Figure 1-1 have the same MST region configuration: the same region name, the same VLAN-to-MSTI mappings (that is, VLAN 1 is mapped to spanning tree instance 1, VLAN 2 is mapped to spanning tree instance 2, and other VLANs
are mapped to CIST), and the same MSTP revision level (not shown in Figure 1-1).
II. MSTI
A multiple spanning tree instance (MSTI)
refers to a spanning tree in an MST region.
Multiple spanning trees can be established
in one MST region. These spanning trees are independent of each other. For
example, each region in Figure
1-1 contains multiple spanning trees known as MSTIs. Each of these spanning trees corresponds to a VLAN.
III. VLAN mapping table
A VLAN mapping table is a property of an MST
region. It contains information about how VLANs are mapped to MSTIs. For
example, in Figure 1-1, the VLAN mapping table of region A0 is: VLAN 1 is mapped to MSTI 1; VLAN 2 is mapped to MSTI 2; and other VLANs are mapped to CIST. In an MST region, load balancing is implemented according to the VLAN
mapping table.
IV. IST
An internal spanning tree (IST) is a
spanning tree in an MST region.
ISTs together with the common spanning tree
(CST) form the common and internal spanning tree (CIST) of the entire switched
network. An IST is a special MSTI; it is a branch of CIST in the MST region. In
Figure 1-1, each MST region has an IST, which is a branch of the CIST.
V. CST
A CST is a single spanning tree in a
switched network that connects all MST regions in the network. If you regard each
MST region in the network as a switch, then the CST is the spanning tree
generated by STP or RSTP running on the "switches". In Figure 1-1, the lines in red depict the CST.
VI. CIST
A CIST is the spanning tree in a switched
network that connects all switches in the network. It comprises the ISTs and
the CST. In Figure 1-1, the ISTs in the MST regions and the CST connecting the MST regions form the CIST.
VII. Region root
A region root is the root of the IST or an MSTI
in an MST region. Different spanning trees in an MST region may have different
topologies and thus have different region roots. In region D0 shown in Figure 1-1, the region root of MSTI 1 is switch B, and the region root of MSTI 2 is switch C.
VIII. Common root bridge
The common root bridge is the root of the
CIST. The common root bridge of the network shown in Figure 1-1 is a switch in region A0.
IX. Port role
During MSTP calculation, the following port
roles exist: root port, designated port, master port, region edge port,
alternate port, and backup port.
l
A root port is used to forward packets to the
root.
l
A designated port is used to forward packets to a
downstream network segment or switch.
l
A master port connects an MST region to the
common root. The path from the master port to the common root is the shortest
path between the MST region and the common root.
l
A region edge port is located on the edge of an
MST region and is used to connect one MST region to another MST region, an
STP-enabled region or an RSTP-enabled region
l
An alternate port is a backup port of a master
port. It becomes the master port if the existing master port is blocked.
l
A loop occurs when two ports of a switch are
connected to each other. In this case, the switch blocks one of the two ports.
The blocked port is a backup port.
In Figure 1-2, switch A, switch B, switch C, and switch D form an MST region. Port 1 and port 2 on switch A connect upstream to the common root. Port 5 and port 6 on switch C form a loop. Port 3 and port 4 on switch D
connect downstream to other MST regions. This figure shows the roles these
ports play.
l
A port can play different roles in different MSTIs.
l
The role a region edge port plays is consistent
with the role it plays in the CIST. For example, port 1 on switch A in Figure 1-2 is a region edge port, and it is a master port in the CIST. So it is a master port in all MSTIs in the region.

Figure 1-2 Port roles
X. Port state
Ports can be in one of the following three
states:
l
Forwarding state: Ports in this state can forward
user packets and receive/send BPDU packets.
l
Learning state: Ports in this state can receive/send
BPDU packets.
l
Discarding state: Ports in this state can only receive
BPDU packets.
Port roles and port states are not mutually
dependent. Table 1-1 lists possible combinations of port states and port roles.
Table 1-1 Combinations
of port states and port roles
|
Port
role
Port state
|
Root/ port/Master port
|
Designated port
|
Region edge port
|
Alternate port
|
Backup port
|
|
Forwarding
|
√
|
√
|
√
|
—
|
—
|
|
Learning
|
√
|
√
|
√
|
—
|
—
|
|
Discarding
|
√
|
√
|
√
|
√
|
√
|
MSTP divides a Layer 2 network into
multiple MST regions. The CSTs are generated between these MST regions, and
multiple spanning trees (also called MSTIs) can be generated in each MST region.
As well as RSTP, MSTP uses configuration BPDUs for spanning tree calculation. The
only difference is that the configuration BPDUs for MSTP carry the MSTP
configuration information on the switches.
I. Calculate the CIST
Through comparing configuration BPDUs, the
switch of the highest priority in the network is selected as the root of the
CIST. In each MST region, an IST is calculated by MSTP. At the same time, MSTP regards
each MST region as a switch to calculate the CSTs of the network. The CSTs, together
with the ISTs, form the CIST of the network.
II. Calculate an MSTI
In an MST region, different MSTIs are
generated for different VLANs based on the VLAN-to-MSTI mappings. Each spanning
tree is calculated independently, in the same way as how STP/RSTP is calculated.
III. Implement STP algorithm
In the beginning, each switch regards
itself as the root, and generates a configuration BPDU for each port on it as a
root, with the root path cost being 0, the ID of the designated bridge being
that of the switch, and the designated port being itself.
1)
Each switch sends out its configuration BPDUs
and operates in the following way when receiving a configuration BPDU on one of
its ports from another switch:
l
If the priority of the configuration BPDU is
lower than that of the configuration BPDU of the port itself, the switch discards
the BPDU and does not change the configuration BPDU of the port.
l
If the priority of the configuration BPDU is
higher than that of the configuration BPDU of the port itself, the switch
replaces the configuration BPDU of the port with the received one and compares it
with those of other ports on the switch to obtain the one with the highest
priority.
2)
Configuration BPDUs are compared as follows:
l
The smaller the root ID of the configuration
BPDU is, the higher the priority of the configuration BPDU is.
l
For configuration BPDUs with the same root IDs,
the path costs are compared. Suppose S is the sum of the root path costs and
the corresponding path cost of the port. The less the S value is, the higher the
priority of the configuration BPDU is.
l
For configuration BPDUs with both the same root
ID and the same root path cost, the designated bridge ID, designated port ID,
the ID of the receiving port are compared in turn.
3)
A spanning tree is calculated as follows:
l
Determining the root bridge
Root bridges are selected by configuration
BPDU comparing. The switch with the smallest root ID is chosen as the root
bridge.
l
Determining the root port
For each switch in a network, the port on
which the configuration BPDU with the highest priority is received is chosen as
the root port of the switch.
l
Determining the designated port
First, the switch calculates a designated
port configuration BPDU for each of its ports using the root port configuration
BPDU and the root port path cost, with the root ID being replaced with that of
the root port configuration BPDU, root path cost being replaced with the sum of
the root path cost of the root port configuration BPDU and the path cost of the
root port, the ID of the designated bridge being replaced with that of the
switch, and the ID of the designated port being replaced with that of the port.
The switch then compares the calculated configuration
BPDU with the original configuration BPDU received from the corresponding port
on another switch. If the latter takes precedence over the former, the switch
blocks the local port and keeps the port's configuration BPDU unchanged, so
that the port can only receive configuration messages and cannot forward
packets. Otherwise, the switch sets the local port to the designated port,
replaces the original configuration BPDU of the port with the calculated one
and advertises it regularly.
MSTP is compatible with both STP and RSTP.
That is, MSTP-enabled switches can recognize the protocol packets of STP and
RSTP and use them for spanning tree calculation. In addition to the basic MSTP
functions, H3C series switches also provide the following functions for the
convenience of users to manage their switches:
l
Root bridge hold
l
Root bridge backup
l
Root protection
l
BPDU protection
l
Loop prevention
Table
1-2 lists MSTP-related configurations about root bridges.
Table 1-2 Configure
root bridge
In a network containing
switches with both GVRP and MSTP enabled, GVRP packets are forwarded along the
CIST. If you want to advertise packets of a specific VLAN through GVRP, be sure
to map the VLAN to the CIST when configuring the MSTP VLAN mapping table (the
CIST of a network is spanning tree instance 0).
The role (root, branch, or leaf) of each
switch in each spanning tree instance is determined.
I. Configuration procedure
Table 1-3 Configure an MST region
|
Operation
|
Command
|
Description
|
|
Enter system view
|
system-view
|
—
|
|
Enter MST region view
|
stp region-configuration
|
—
|
|
Configure the name of the MST region
|
region-name name
|
Required
The default MST region name of a switch
is its MAC address.
|
|
Configure the VLAN mapping table for the
MST region
|
instance instance-id
vlan vlan-list
|
Required
Both commands can be used to configure
VLAN mapping tables.
By default, all VLANs in an MST region
are mapped to spanning tree instance 0.
|
|
vlan-mapping modulo modulo
|
|
Configure the MSTP revision level for the
MST region
|
revision-level level
|
Required
The default revision level of an MST
region is level 0.
|
|
Activate the configuration of the MST
region manually
|
active region-configuration
|
Required
|
|
Display the configuration of the current
MST region
|
check region-configuration
|
Optional
|
|
Display the currently valid configuration
of the MST region
|
display stp region-configuration
|
You can execute this command in any view.
|
Configuring MST region-related parameters (especially the VLAN
mapping table) results in spanning tree recalculation and network topology
jitter. To reduce network topology jitter caused by the configuration, MSTP
does not recalculate spanning trees immediately after the configuration; it
does this only after you perform one of the following operations, and then the
configuration can really takes effect:
l
Activate the new MST region-related settings by
using the active region-configuration command
l
Enable MSTP by using the stp enable
command
Switches belong to the same MST region only when they have the same
MST region name, VLAN mapping table, and MSTP revision level.
II. Configuration example
# Configure an MST region, with the name
being “info”, the MSTP revision level being level 1, VLAN 2 through
VLAN 10 being mapped to spanning tree instance 1, and VLAN 20 through VLAN 30
being mapped to spanning tree 2.
<H3C> system-view
[H3C] stp region-configuration
[H3C-mst-region] region-name info
[H3C-mst-region] instance 1 vlan 2 to
10
[H3C-mst-region] instance 2 vlan 20
to 30
[H3C-mst-region] revision-level 1
[H3C-mst-region] active
region-configuration
# Verify the above configuration.
[H3C-mst-region]
check region-configuration
Admin configuration
Format selector :0
Region name :info
Revision level :1
Instance Vlans Mapped
0 11 to 19, 31 to 4094
1 1 to 10
2 20 to 30
MSTP can automatically
choose a switch as a root bridge through calculation. You can also manually specify
the current switch as a root bridge by using the corresponding commands.
I. Specify the current switch as the
root bridge of a specified spanning tree
Table 1-4 Specify the current switch as
the root bridge of a specified spanning tree
|
Operation
|
Command
|
Description
|
|
Enter
system view
|
system-view
|
—
|
|
Specify
the current switch as the root bridge of a specified spanning tree
|
stp [ instance instance-id ] root primary [ bridge-diameter
bridgenumber ] [ hello-time centi-seconds ]
|
Required
|
II. Specify the current switch as
the secondary root bridge of a specified spanning tree
Table 1-5 Specify the current switch as
the secondary root bridge of a specified spanning tree
|
Operation
|
Command
|
Description
|
|
Enter system view
|
system-view
|
—
|
|
Specify the current switch as the
secondary root bridge of a specified spanning tree
|
stp [ instance
instance-id ] root secondary [ bridge-diameter bridgenumber
] [ hello-time centi-seconds ]
|
Required
|
Using the stp root primary/stp
root secondary command, you can specify the current switch as the root
bridge or the secondary root bridge of the spanning tree instance identified by
the instance-id argument. If the value of the instance-id
argument is set to 0, the stp root primary/stp root secondary
command specify the current switch as the root bridge or the secondary root
bridge of the CIST.
A switch can play different roles in
different spanning tree instances. That is, it can be the root bridges in a
spanning tree instance and be a secondary root bridge in another spanning tree
instance at the same time. But in the same spanning tree instance, a switch
cannot be the root bridge and the secondary root bridge simultaneously.
When the root bridge fails or is turned
off, the secondary root bridge becomes the root bridge if no new root bridge is
configured. If you configure multiple secondary root bridges for a spanning
tree instance, the one with the smallest MAC address replaces the root bridge when
the latter fails.
You can
specify the network diameter and the hello time parameters while configuring a
root bridge/secondary root bridge. Refer to section 1.2.8 “Configuring the Network Diameter of
the Switched Network” and 1.2.9 “Configuring the MSTP Time-related Parameters” for information about the network diameter parameter and the hello time parameter.
l
You can configure
a switch as the root bridges of multiple spanning tree instances. But you
cannot configure two or more root bridges for
one spanning tree instance. So, do not configure root bridges for the same
spanning tree instance on two or more switches using the stp root primary command.
l
You can configure multiple secondary root
bridges for one spanning tree instance. That is, you can configure secondary
root bridges for the same spanning tree instance on two or more switches using
the stp root secondary command.
l
You can also configure the current switch as the
root bridge by setting the priority of the switch to 0. Note that once a switch
is configured as the root bridge or a secondary root bridge, its priority
cannot be modified.
III. Configuration example
# Configure the current switch as the root
bridge of spanning tree instance 1 and a secondary root bridge of spanning tree
instance 2.
<H3C> system-view
[H3C] stp instance 1 root primary
[H3C] stp instance 2 root secondary
Root bridges are selected according to the
bridge priorities of switches. You can make a specific switch be selected as a
root bridge by setting a lower bridge priority for the switch. An MSTP-enabled
switch can have different bridge priorities in different spanning tree
instances.
I. Configuration procedure
Table 1-6 Configure the bridge priority of
the current switch
|
Operation
|
Command
|
Description
|
|
Enter
system view
|
system-view
|
—
|
|
Set the
bridge priority for the current switch
|
stp [ instance instance-id ] priority priority
|
Required
The
default bridge priority of a switch is 32,768.
|
Caution:
l
Once you specify a switch as the root bridge or
a secondary root bridge by using the stp root
primary or stp root secondary
command, the bridge priority of the switch cannot be configured any more.
l
During the selection of the root bridge, if
multiple switches have the same bridge priority, the one with the smallest MAC
address becomes the root bridge.
II. Configuration example
# Set the bridge priority of the current switch
to 4,096 in spanning tree instance 1.
<H3C> system-view
[H3C] stp instance 1 priority 4096
You can set the MSTP packet format to the
following three formats for a port: auto, legacy, and dot1s
(802.1s).
l
With the MSTP packet format set to auto,
the port automatically determines the format of the received MSTP packets (legacy
or dot1s) and then decides the format of packets to be transmitted, thus
implementing communication with the peer device. If the format of the received
packets from the peer device changes repeatedly, MSTP will shut down the
corresponding port to prevent network storm. A port shut down in this way can
only be enabled again by the network administrator after login.
l
With the MSTP packet format set to legacy,
the port processes and transmits only MSTP packets in legacy format,
thus implementing communication with the peer device sending packets in legacy
format. If packets in dot1s format are received, the corresponding ports
are set to the discarding state to prevent network storm.
l
With the MSTP packet format set to dot1s,
the port processes and transmits only MSTP packets in dot1s format, thus
implementing communication with the peer device sending packets in dot1s
format. If packets in legacy format are received, the corresponding ports
are set to the discarding state to prevent network storm.
l
All the ports in an aggregation group use the
same MSTP packet format.
I. Configuration procedure
Table 1-7
Configure MSTP packet format for the port
|
Operation
|
Command
|
Description
|
|
Enter system view
|
system-view
|
—
|
|
Enter Ethernet port view
|
interface interface-type interface-number
|
—
|
|
Configure MSTP packet format for the port
|
stp compliance { auto | dot1s | legacy }
|
Required
By default, an MSTP packet is in legacy
format.
|
II. Configuration Example
# Configure the MSTP packet format as dot1s
(802.1s).
<H3C> system-view
[H3C] interface Ethernet1/0/1
[H3C-Ethernet1/0/1] stp compliance
dot1s
# Restore the MSTP packet format to the
default value.
[H3C-Ethernet1/0/1] undo stp
compliance
A MSTP-enabled
switch can operate in one of the following operation modes:
l
STP-compatible mode: In this mode, all ports of
the switches send STP packets. If the switched network contains STP-enabled
switches, you can configure the current MSTP-enabled switch to operate in this
mode by using the stp mode stp command.
l
RSTP-compatible mode: In this mode, all ports of
the switches send RSTP packets. If the switched network contains RSTP-enabled
switches, you can configure the current MSTP-enabled switch to operate in this
mode by using the stp mode rstp command.
l
MSTP mode: In this mode, all the ports of the
switches send MSTP packets or STP packets (if the port is connected to an
STP-enabled switch). In this case, the multiple spanning tree function is
enabled as well.
I. Configuration procedure
Table 1-8 Configure the MSTP operation
mode
|
Operation
|
Command
|
Description
|
|
Enter system view
|
system-view
|
—
|
|
Configure the MSTP operation mode
|
stp mode {
stp | rstp | mstp }
|
Required
An MSTP-enabled switch operates in the
MSTP mode by default.
|
II. Configuration example
# Configure the current MSTP-enabled switch
to operate in the STP-compatible mode.
<H3C>
system-view
[H3C] stp mode stp
The maximum hops configured on the region root
is also the maximum hops of an MST region. The value of the maximum hops limits
the size of the MST region.
A configuration BPDU contains a field that
maintains the remaining hops of the configuration BPDU. And a switch discards
the configuration BPDUs whose remaining hops are 0. After a configuration BPDU
reaches a root bridge of a spanning tree in an MST region, the value of the
remaining hops field in the configuration BPDU is decreased by 1 every time the
configuration BPDU passes one switch. Such a mechanism disables the switches
that are beyond the maximum hops from participating in spanning tree calculation,
and thus limits the size of an MST region.
With such a mechanism, the maximum hops
configured on the switch operating as the root bridge of the CIST or an MSTI in
an MST region becomes the network diameter of the spanning tree, which limits
the size of the spanning tree in the current MST region. The switches that are
not root bridges in the MST region adopt the maximum hop settings of their root
bridges.
I. Configuration procedure
Table 1-9 Configure the maximum hops for
an MST region
|
Operation
|
Command
|
Description
|
|
Enter system view
|
system-view
|
—
|
|
Configure the maximum hops of the MST
region
|
stp max-hops hops
|
Required
By default, the maximum hops of an MST
region are 20.
|
The bigger the maximum hops are in an MST
region, the larger the MST region is. Note that only the maximum hop settings
on the switch operating as a region root can limit the size of the MST region.
II. Configuration example
# Configure the maximum hops of the MST
region to be 30.
<H3C> system-view
[H3C] stp max-hops 30
In a switched network, any two switches can
communicate with each other through a specific path made up of multiple switches.
The network diameter of a network is measured by the number of switches; it
equals the number of the switches on the longest path (that is, the path containing
the maximum number of switches).
I. Configuration procedure
Table 1-10 Configure the network
diameter of the switched network
|
Operation
|
Command
|
Description
|
|
Enter system view
|
system-view
|
—
|
|
Configure the network diameter of the switched
network
|
stp bridge-diameter bridgenumber
|
Required
The default network diameter of a network
is 7.
|
The network diameter parameter indicates
the size of a network. The bigger the network diameter is, the larger the
network size is.
After you configure the network diameter of
a switched network, an MSTP-enabled switch adjusts its hello time, forward
delay, and max age settings accordingly to better values.
The network diameter setting only applies
to only CIST; it is invalid for MSTIs.
II. Configuration example
# Configure the network diameter of the
switched network to 6.
<H3C> system-view
[H3C] stp bridge-diameter 6
You can configure
three MSTP time-related parameters for a switch: forward delay, hello time, and
max age.
l
The forward delay parameter sets the delay of
state transition.
Link failures in a network result in the
spanning tree recalculation and spanning tree structure change. As the newly calculated
configuration BPDUs cannot be advertised across the entire network immediately when
the new spanning trees are calculated, temporary loops may occur if