Net work is on the road--understand the MSTP protocol in one article

For STP Spanning Tree Protocol, more people know it. Through the STP protocol, the loop problem in the Layer 2 network is solved, and a balance is reached between loop elimination and link backup. However, in the current network, there is often more than one VLAN in a Layer 2 network, but a collection of multiple VLANs. STP/RSTP can only deal with the problem of a single VLAN, but can't do anything about the situation of multiple VLANs. Therefore, the emergence of MSTP is crucial.
In this article, by querying Huawei Hex documents, combined with our own understanding, a relatively clear and important MSTP document is formed, which may be the most detailed MSTP document on the entire network.

1 definition

MSTP (multiple spanning tree protocol) is a multiple spanning tree protocol that solves the Ethernet loop problem by generating multiple spanning trees.

2 Purpose

  • Generate multiple STP trees in a LAN, solve the broadcast storm of multiple VLANs, and implement redundant backup.
  • Multiple STP trees implement load balancing among VLANs, and traffic of different VLANs is forwarded according to different paths. Solve the problem that all vlans are blocked after a vlan link of stp/rstp is blocked.
    Net work is on the road--understand the MSTP protocol in one article
    In this figure, if stp/rstp is applied in the entire network, a spanning tree represented by a dashed line will be obtained according to the requirements of the agreement. Among them, S6 is the root bridge, the chain between S2 and S5, and between S1 and S4 The road is blocked. If there is only one vlan or vlan's allowed links in the network, the stp/rstp has already met the requirements of the existing network. However, since only vlan3 is allowed to pass between s1 and s2, between s3 and s6, and only vlan2 is allowed between s4 and s5, communication between hostB and hostA is not possible.
    Therefore, the introduction of the MSTP protocol is needed to solve this problem.

    3 Principle

    MSTP divides a switching network into multiple domains. Each domain forms multiple spanning trees. The spanning trees are independent of each other. Each spanning tree is called a multiple spanning tree instance (MSTI), and each domain is called a multiple spanning tree instance. MST region (multiple spanning tree region). Each MSTI can be regarded as a collection of multiple VLANs, that is, VLANs are bound to several MSTIs as needed (generally speaking, this need refers to the same topology). VLANs and MSTIs have a many-to-one relationship, so Can save communication overhead and resource occupancy rate.
    Net work is on the road--understand the MSTP protocol in one article
    After the introduction of MSTP, MSTP associates vlan and msti by setting a vlan mapping table. According to the needs of the existing network, each vlan in the network corresponds to a msti. It can be considered that an independent stp protocol is allowed between each msti.
    After calculation, two trees are finally generated:

  • MSTI1 uses S4 as the root switching device to forward VLAN 2 packets
  • MSTI2 uses S6 as the root switching device to forward VLAN 3 packets. In the
    past, we thought that there would only be one root bridge in a switching network. However, after the introduction of MSTP, there can be multiple root bridges in the switching network. The number of root bridges is the same as that of MSTI. The number is the same.

4 basic concepts

4.1 Network level

An MSTP network contains multiple MST regions, each MST region contains multiple MSTIs, and an MSTI contains multiple switching devices running STP/RSTP/MSTP

Net work is on the road--understand the MSTP protocol in one article

4.2 MST region

The MST domain is composed of multiple switching devices in the switching network and the network segments between them. Devices in the same MST region have the following characteristics:

  • MSTP is enabled
  • Have the same domain name (region name)
  • The same vlan-MSTI mapping relationship (instance xx vlan xx)
  • Same MSTP revision level configuration (region level)

MST regions are physically connected directly or indirectly.

4.3 VLAN mapping table

Describes the mapping relationship between vlan and MSTI, which is a many-to-one relationship.

4.4 CST

The common spanning tree is a spanning tree that connects all MST regions in the switching network. If the MST region is regarded as a node or bridge, then the CST is a spanning tree generated by these nodes through STP/RSTP calculation.

4.5 CIST & IST

  • CIST is a public and internal spanning tree. It is generated by STP/RSTP. All switching devices in the switching network are regarded as devices without VLAN distinction, and a single spanning tree is generated by them.
  • IST is an internal spanning tree, which is a spanning tree in the MST region. IST is a special MSTI. The ID of MSTI is 0, usually called MSTI0. IST can be understood as a subset of CIST in the MST domain.

    4.6 SST

    Single spanning tree, the switching device running STP/RSTP can only belong to one spanning tree. Or there is only one switching device in the MST domain, and this switching device forms a single spanning tree.

    4.7 Total Root & Domain Root

  • The common root is the root bridge of CIST.
  • Regional roots are divided into IST regional roots and MSTI regional roots.
  • The IST regional root is the switching device closest to the common root in the IST spanning tree in the MST region.
  • The MSTI region root is the root of each MSTI instance. There can be multiple spanning tree instances in an MSTI region, that is, multiple MSTI region roots.

    4.8 Main Bridge

    IST Master, the switching device closest to the common root in the domain.

    5 port role

    Compared with RSTP, MSTP adds master ports and domain edge ports on the basis of root ports, designated ports, alternate ports, backup ports, and edge ports. That is, there are 7 types of ports.

    5.1 master port

    It is the port on the shortest path of all paths connecting the MST region and the common root, and is the port on the switching device that connects the MST region to the common root. The master port is the only way for packets in the domain to go to the common root. The master port is a special domain edge port. Its role on CIST is the root port, and its role on other instances is the master port.

Net work is on the road--understand the MSTP protocol in one article

5.2 Domain Edge Port

Ports located at the edge of the MST region and connected to other MST regions or SST.

6 MSTP message format

Net work is on the road--understand the MSTP protocol in one article

Compared with the RST BPDU message, the first 36 bytes of the MSTP BPDU message are the same. Starting from the 37th byte is its exclusive field.
Currently, there are two formats of MST BPDU. They are:

  • dot1s
  • Legacy
    requires manual identification, manual configuration, and mismatches into a loop.
    Huawei's new addition: auto
    realizes automatic recognition and automatic adaptation. Initial support for dot1s.

    7 MSTP topology calculation

    MSTP divides the Layer 2 network into multiple MST regions, calculates the production CST between the regions, and divides the region into multiple spanning tree instances, and each instance calculates an independent STP spanning tree.
    Instance 0 is called IST, and other MSTI instances are MSTI.

    7.1 Priority vector

  • MSTI priority vector {domain root ID, internal path cost, designated switching device ID, designated port ID, receiving port ID}
  • The priority vector of CIST {root switching device ID, external path cost, domain root ID, internal path cost, designated switching device ID, designated port ID, receiving port ID}
    decreases from left to right.
Vector name Description
Root switching device ID The root switching device ID of CIST, equal to priority (16bit) + MAC (48bit), where priority is the priority of MSTI0
External path cost (ERPC) The path cost from the regional root of the CIST to the common root. The external path costs saved on all switching devices in the MST region are the same. If the CIST root switching device is in a domain, the external path cost saved on all switching devices in the domain is 0.
Domain root ID The regional root ID is used to select the regional root in MSTI. Regional root ID = Priority(16bits) + MAC(48bits). Priority is the priority of MSTI0.
Internal path cost (IRPC) The path cost of the local bridge to the regional root. The internal path cost saved by the domain edge port is greater than the internal path cost saved by the non-domain edge port.
Specify the switching device ID The designated switching device of the CIST or MSTI instance is the nearest upstream bridge from the local bridge to the regional root. If the local bridge is the common root or regional root, then the designated switching device is itself.
Specify the port ID Specify the port on the switching device that is connected to the root port of the device. Port ID = Priority (4 digits) + port number (12 digits). The port priority must be an integer multiple of 16.
Receiving port ID The port that received the BPDU packet. Port ID = Priority (4 digits) + port number (12 digits). The port priority must be an integer multiple of 16.

7.2 Principles of Comparison

Comparing the same vector, the vector with the smallest value has the highest priority.

  • 1 Compare the ID of the root switch.

  • 2 If the root switching device IDs are the same, compare the external path costs.

  • 3 If the external path costs are the same, compare the regional root IDs.

  • 4 If the regional root ID is still the same, compare the internal path costs.

  • 5 If the internal paths are still the same, compare the IDs of the designated switching devices.

  • 6 If the IDs of the designated switching devices are still the same, compare the IDs of the designated ports.

  • 7 If the designated port IDs are still the same, compare the receiving port IDs.

If the configuration message contained in the BPDU received by the port is better than the configuration message saved on the port, the configuration message originally saved on the port is replaced by the newly received configuration message. The port also updates the global configuration message saved by the switching device. Otherwise, the newly received BPDU is discarded.

7.3 Calculation of CIST

After comparing the configuration messages, a switching device with the highest priority is selected as the root of the CIST in the entire network. In each MST region, MSTP generates IST through calculation; at the same time, MSTP treats each MST region as a single switching device, and generates CST between MST regions through calculation. CST and IST constitute the CIST of the entire switching equipment network.

7.4 Calculation of MSTI

In the MST domain, MSTP generates different spanning tree instances for different VLANs based on the mapping relationship between VLANs and spanning tree instances. Each spanning tree is calculated independently, and the calculation process is similar to that of STP calculation spanning tree

Features of MSTI:

  • Each MSTI calculates its own spanning tree independently and does not interfere with each other.

  • The calculation method of spanning tree for each MSTI is basically the same as that of STP.

  • Each MSTI spanning tree can have different roots and different topologies.

  • Each MSTI sends BPDUs in its own spanning tree.

  • The topology of each MSTI is determined by command configuration.

  • The spanning tree parameters of each port on different MSTIs can be different.

  • The role and status of each port on different MSTIs can be different.

In a network running MSTP, a VLAN packet will be forwarded along the following path:

  • In the MST domain, it is forwarded along its corresponding MSTI.
  • Between MST regions, it is forwarded along the CST.

8 MSTP fast convergence mechanism (P/A mechanism)

8.1 Ordinary way

Net work is on the road--understand the MSTP protocol in one article

-1 Both ports p0 and p1 immediately become designated ports and send RST BPDUs.
-2 S2's p1 port receives a better RST BPDU, and immediately realizes that it will become the root port instead of the designated port, and stops sending RST BPDUs.

  • 3 S1's p0 enters the Discarding state, so the proposal and Agreement are set to 1 in the RST BPDU sent.
  • 4 S2 receives the RST BPDU carrying the proposal sent by the root bridge, and starts to set all its ports into the sync variable.
  • 5 p2 has been blocked, and the state remains unchanged; p4 is an edge port and does not participate in operations; therefore, only non-edge designated port p3 needs to be blocked.
  • 6 After the synced variable of each port is set, p2 and p3 enter the Discarding state, and p1 enters the Forwarding state and returns to S1 a response RST BPDU with the Agreement bit set.
  • 7 When S1 judges that this is a response to the Proposal just sent, port p0 immediately enters the Forwarding state.
    The downstream device continues to perform the P/A negotiation process.

8.2 Enhancement method

Net work is on the road--understand the MSTP protocol in one article

  • 1 At the beginning of the negotiation, each device considers itself to be the root bridge, the port on the root bridge is the designated port, the port status is Discarding, the synced variable of the port is set, and the Proposal and Agreement are triggered at the same time. The upstream device sends a Proposal message, requesting rapid migration. After the downstream device receives it, it sets the port connected to the upstream device as the root port and blocks all non-edge ports.

  • 2 The upstream device continues to send Agreement packets. After the downstream device receives it, the root port changes to the Forwarding state.

  • 3 The downstream device responds to the Agreement message. After the upstream device receives it, it sets the port connected to the downstream device as the designated port, and the designated port enters the Forwarding state.

By default, Huawei data communication equipment uses an enhanced rapid migration mechanism.

Guess you like

Origin blog.51cto.com/1965839/2644404