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 transit to the forwarding state even
if the port is on a point-to-point link or the port is an edge port. This slows
down the spanning tree convergence of STP.
Rapid spanning tree
protocol (RSTP) enables the spanning tree to converge rapidly, but it suffers
from the same drawback as that of 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 by VLANs.
As well as the above
two protocols, 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. Besides this,
MSTP can also provide multiple redundant paths for packet forwarding and
balances the forwarding loads of different VLANs.
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 with redundant links.
Bridge protocol data
unit (BPDU) 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 the information that is needed for switches to figure out
the spanning tree.
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 to figure out spanning trees 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
An MST region (multiple
spanning tree 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-spanning-tree
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-spanning-tree 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), 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 a 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 (multiple spanning tree
instances). 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
information contained in 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 achieved by 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 belongs to an MST
region and is a branch of CIST. In Figure 1-1,
each MST region has an IST, which is a branch of the CIST.
V. CST
A CST is the 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 a 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
roles
In MSTP, 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 a 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 the 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, B, C, and 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
states
Ports can be in 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.
Table
1-1 lists possible combinations of port states and port roles.
Table 1-1 Combinations of port states and port roles
|

|
Root/ port/Master
port
|
Designated port
|
Region edge port
|
Alternate port
|
Backup port
|
|
Forwarding
|
√
|
√
|
√
|
—
|
—
|
|
Learning
|
√
|
√
|
√
|
—
|
—
|
|
Discarding
|
√
|
√
|
√
|
√
|
√
|
MSTP divides a network
into multiple MST regions at Layer 2. The CST is generated between these MST
regions, and multiple spanning trees (or, MSTIs) can be generated in each MST
region. As well as RSTP, MSTP uses configuration BPDUs to generate spanning
trees. The only difference is that the configuration BPDUs for MSTP carry the
MSTP configuration information on the switches.
I. Generating
the CIST
Through configuration BPDU
comparing, the switch that is of the highest priority in the network is chosen
as the root of the CIST. In each MST region, an IST is figured out by MSTP. At
the same time, MSTP regards each MST region as a switch to figure out the CST
of the network. The CST, together with the ISTs, forms the CIST of the network.
II. Generating
an MSTI
In an MST region,
different MSTIs are generated for different VLANs depending on the
VLAN-to-spanning-tree mappings. Each spanning tree is figured out
independently, in the same way as STP/RSTP.
III. Implementation
of 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 comparison is based on the path costs. Suppose S is the
sum of the root path cost 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 figured
out as follows:
l
Determining the root bridge
The root bridge is
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 through 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
generates a designated port configuration BPDU for each of its port 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 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 resulting 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 remains 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 resulting one and releases it regularly.
MSTP is compatible with
both STP and RSTP. That is, switches with MSTP employed can recognize the
protocol packets of STP and RSTP and use them to generate spanning trees. In
addition to the basic MSTP functions, H3C series switches also provide the
following other functions for the convenience of users to manage their
switches.
l
Root bridge retaining
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 Root bridge
configuration
In
a network that contains switches with both GVRP and MSTP employed, GVRP packets
are forwarded along the CIST. If you want to broadcast 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 the spanning tree instance
numbered 0.)
The status of the
switches in the spanning trees are determined. That is, the status (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 a name
for the MST region
|
region-name name
|
Required
The default MST
region name of a switch is its MAC address.
|
|
Configure the
VALN 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 trees being
regenerated. To reduce network topology jitter caused by the configuration,
MSTP does not regenerate 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
Activating the new MST
region-related settings by using the active region-configuration command
l
Enabling 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. You can also manually
specify the current switch as a root bridge by using the corresponding
commands.
I. Root
bridge configuration
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. Secondary
root bridge configuration
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 a 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 one 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 least 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.7 “Network Diameter Configuration” and 1.2.8 “MSTP
Time-related Configuration” 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 by the bridge priorities of switches. You can make a specific switch
being selected as a root bridge by set a higher bridge priority for the switch
(Note that a smaller bridge priority value indicates a higher bridge priority.)
A MSTP-enabled switch can have different bridge priorities in different
spanning tree instances.
I. Configuration
procedure
Table 1-6 Assign a
bridge priority to a switch
|
Operation
|
Command
|
Description
|
|
Enter system view
|
system-view
|
—
|
|
Set a 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 is not configurable.
l During the selection of the root bridge, if
multiple switches have the same bridge priority, the one with the least MAC
address becomes the root bridge candidate.
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
A
MSTP-enabled switch can operate in one of the following operation modes:
l
STP-compatible mode: In this
mode, the protocol packets sent out of the ports of the switch are 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, the protocol packets sent out of the ports of the switch are 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, the
protocol packets sent out of the ports of the switch are MSTP packets, or STP
packets if the ports have STP-enabled switches connected. But multiple spanning
tree function is only enabled for MSTP packets.
I. Configuration
procedure
Table 1-7 Configure
MSTP operation mode
|
Operation
|
Command
|
Description
|
|
Enter system view
|
system-view
|
—
|
|
Configure the
MSTP operation mode for the switch
|
stp mode { stp | rstp | mstp }
|
Required
A MSTP-enabled switch
operates in the MSTP mode by default.
|
II. Configuration
example
# Configure the current
switch to operate in the STP-compatible mode.
<H3C>
system-view
[H3C] stp mode
stp
The maximum hops values
configured on the region roots in an MST region limit 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 a MST region,
the value of the remaining hops field in the configuration BPDU is decreased by
1 every time the configuration BPDU passes a switch. Such a mechanism disables
the switches that are beyond the maximum hops from participating in spanning
tree generation, 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
IST or an MSTI in a 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 hops
settings of their root bridges.
I. Configuration
procedure
Table 1-8 Configure
the maximum hops for an MST region
|
Operation
|
Command
|
Description
|
|
Enter system view
|
system-view
|
—
|
|
Configure the
maximum hops for the MST region
|
stp max-hops hops
|
Required
By default, the
maximum hops of an MST region are 20.
|
Note that only the
maximum hops settings on the switches operating as region roots can limit the
size of the MST region.
II. Configuration
example
# Configure the maximum
hops of the MST region to be 30 (assuming that the current switch operates as the
region root).
<H3C>
system-view
[H3C] stp
max-hops 30
In a switched network,
any two switches can communicate with each other through a path, on which there
may be some other 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 contains the maximum number of switches).
I. Configuration
procedure
Table 1-9 Configure
the network diameter for a network
|
Operation
|
Command
|
Description
|
|
Enter system view
|
system-view
|
—
|
|
Configure the
network diameter for a 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 larger the network diameter is,
the larger the network size is.
After you configure the
network diameter of a switched network, A MSTP-enabled switch adjusts its Hello
time, Forward delay, and Max age settings accordingly.
The network diameter
setting only applies to 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 problems occurred
in a network results in the spanning trees being regenerated and original
spanning tree structures being changed. As the newly generated configuration
BPDUs cannot be propagated across the entire network immediately when the new
spanning trees are generated, loops may occur if the new root ports and
designated ports begin to forward packets immediately.
This can be avoided by
adopting a state transition mechanism. With this mechanism, newly selected root
ports and designated ports undergo an intermediate state before they begin to
forward packets. That is, it costs these ports a period (specified by the
Forward delay parameter) for them to turn to the forwarding state. The period
ensures that the newly generated configuration BPDUs to propagate across the
entire network.
l
The Hello time parameter is
for link testing.
A switch regularly
sends hello packets to other switches in the interval specified by the Hello
time parameter to test the links.