16.HCNA-HNTD--STP principle and Configuration

Source: Internet
Author: User

The STP (Spanning tree Protocol) is the acronym for the Spanning Tree protocol. This protocol can be used to establish a tree topology in the network, eliminate the loop in the network, and can realize path redundancy through certain methods, but it is not certain that path redundancy can be realized. Spanning tree protocol is suitable for all manufacturers of network equipment, in the configuration and reflect the functional strength of the difference, but in principle and application effect is consistent.

Spanning Tree protocol has two main functions: one is to use spanning tree algorithm, in the Ethernet network, to create a certain port of a switch root spanning tree, avoid loops. The second is to achieve convergence protection through spanning tree protocol when the topology of Ethernet network is changed.

To improve network reliability, redundant links are often used in switched networks. However, redundant links can bring the loop risk to the switched network and cause the broadcast storm and the instability of MAC Address table, which will affect the communication quality of the users. Spanning tree protocol can improve reliability while avoiding various problems caused by loops.

Learning Goals:
1. Master How STP Works
2. Master the basic configuration of STP

Problems caused by loops


As the size of the LAN expands, more and more switches are used to interconnect the hosts. If only one link interconnect is used between the switches, a single point of failure may occur, resulting in a business outage. To solve such problems, the switch typically uses redundant links to make backups when interconnected.
Redundant links, while enhancing the reliability of the network, can also generate loops, which can lead to a series of problems, resulting in a decline in communication quality and interruption in communication services.

Broadcast Storm


Depending on the forwarding principle of the switch, if the switch receives a broadcast frame from a port, or a unicast frame with an unknown destination MAC address, the frame is forwarded to all other ports except the source port. If there is a loop in the switched network, the frame is forwarded indefinitely, and a broadcast storm is created, and the network is flooded with duplicate data frames.
In this example, host a sends out a unicast frame, assuming that the destination MAC address for this unicast frame is temporarily absent from the MAC address table of all switches in the network. After the SWB receives this frame, forwarding it to SWA and Swc,swa and SWC will also forward this frame to all other ports that receive the frame, and the frame will be forwarded to SWB again, and the cycle will continue, resulting in a broadcast storm. The performance of the switch is therefore rapidly declining and can lead to business disruption.

MAC Address Table oscillator


The switch generates a MAC Address table entry based on the source address and receive port of the received data frame.
Host A sends out a unicast frame, assuming that the destination MAC address for this unicast frame is temporarily absent from the MAC address table of all switches in the network. After SWB receives this data frame, it generates a MAC Address table entry in the MAC Address table, 00-01-02-03-04-AA, the corresponding port is G0/0/3, and forwards it from the G0/0/1 and G0/0/2 ports. This example is described only as an example of forwarding this frame from the G0/0/1 port in SWB.
SWA after receiving this frame, SWA will forward this frame from G0/0/2 because there is no table entry in the MAC Address table that corresponds to the MAC address for this frame.
After the SWC receives this frame, the SWC sends this frame back to SWB from the G0/0/2 port and to Host B, because there is no table entry for the MAC address of the frame destination in the MAC address table.
After SWB receives this data frame from the G0/0/2 interface, it deletes the existing related table entry in the MAC Address table, generates a new table entry, 00-01-02-03-04-AA, and the corresponding port is G0/0/2. This process repeats repeatedly, causing the MAC address table to oscillate.

STP working principle the role of STP


In Ethernet, the loop of the two-layer network brings the problems of broadcast storm, MAC Address Table oscillation, repeating data frame and so on, in order to solve the loop problem in the switching network, the STP is proposed.
The main role of STP:
1. Eliminate loops: Eliminate possible loops in the network by blocking redundant links.
2. Link Backup: When the active path fails, the backup link is activated and network connectivity is restored in a timely way.

STP Operations


STP eliminates loops in switched networks by constructing a tree.
In each STP network, there is a root bridge, and the other switches are non-root bridges. The root bridge or root switch is located at the root of the entire logical tree and is the logical center of the STP network, and the non-root bridge is the downstream device of the root bridge. When an existing root bridge fails, the non-root bridge interacts with information and re-selects the root bridge, which is called BPDUs. The BPDUs contain various parameter information that the switch participates in the spanning tree calculation, which is described in more detail later.
Three port roles are defined in STP:* Specify ports, root ports, and prestaged ports *. The specified port is the port on which the switch configures BPDUs for the connected network segment, with each network segment having and only one specified port. In general, each port on the root bridge always specifies a port.
The root port is a non-root switch to the best port on the root bridge path. There is at most one root port on a switch running the STP protocol, but there is no root port on the root bridge.
If a port is neither a specified port nor a root port, this port is a prestaged port. The prestaged port will be blocked.

Root Bridge elections


The root bridge in STP is elected on the basis that each switch in the bridge ID,STP will have a bridge ID. The bridge ID consists of 16-bit bridge priority and 48-bit MAC address. In an STP network, the bridge priority is configurable and the value range is 0~65535, and the default value is 32768. The device with the highest priority (minimum bridge ID) will be elected as the root bridge. If the priority is the same, the MAC address is compared, and the smaller the MAC address, the higher the priority.
After the switch is started, the spanning tree convergence is calculated from the start. By default, all switches start with the view that they are the root bridge, and all of their ports are designated ports so that the BPDU messages can be forwarded through all ports. When the peer switch receives the BPDU message, it compares the root bridge ID and its own bridge ID in the BPDU. If the bridge ID priority in the received BPDU message is low, the receiving switch continues to advertise its own configuration of the BPDU message to the neighbor switch. If the bridge ID in the received BPDU message has a high priority, the switch modifies the root Bridge ID field of its BPDU message to announce the new Root bridge.

Root port Election


The non-root switch is based on the root path cost of the port, the peer bid (Bridge ID), the peer PID (port ID), and the local PID, respectively, when the root port is elected.
Each port of the switch has a port cost parameter, which indicates the cost of the port when it sends the data, which is the cost of the port. STP believes that it is not expensive to receive data from a port. The cost of the port is related to the bandwidth of the port, and the higher the bandwidth, the lower the overhead. There may be multiple paths to the root bridge from a non-root bridge, and each path has a total cost value, which is the sum of the port cost of all the ports on that path, that is, the root path overhead, RPC (root route cost). The non-root bridge determines the shortest path to the root bridge based on the root path cost and generates a non-ring tree network. The root path overhead of the root bridge is 0.
In general, there will be multi-vendor switching devices in the enterprise network, and the Huawei X7 series switches support a variety of STP routing cost calculation standards to provide maximum compatibility. By default, the Huawei X7 series switches use the IEEE 802.1t standard to calculate path overhead.
Each port running the STP switch has a port ID, which consists of the port priority and the end number. The port priority value range is 0 to 240, and the step is 16, that is, the value must be an integer multiple of 16. By default, the port priority is 128. The port ID can be used to determine the port role.
Each non-root bridge is to elect a root port. The root port is the closest port to the root bridge, and the most recent metric is determined by the cumulative root-path overhead, which is the root port, which is the least expensive port for the cumulative root path. After the port receives a BPDU message, it extracts the value of the accumulated root path Cost field in the BPDU message, plus the path cost of the port itself is the cumulative root path overhead. If there are two or more ports in the calculation of the cumulative root path cost is the same, then choose to receive the sender bid the least of the port as the root port.
If two or more ports are connected to the same switch, select the port with the lowest sender PID as the root port. If two or more ports are connected to the same interface on the same switch through the hub, the minimum PID of the switch is chosen as the root port.

Specify port Election


The port on the network segment that suppresses the sending of BPDUs messages on other ports, whether on their own or on other devices, is the specified port for that segment. Each network segment should have a specified port, and all ports on the root bridge are the specified ports (unless the root bridge is physically looped).
The election of the specified port is also the first to compare the cumulative root path overhead, and the port with the least accumulated root path overhead is the specified port. If the cumulative root path overhead is the same, the bridge ID of the switch on which the port is located is compared, and the port with the lowest bridge ID is elected as the specified port. If the cumulative root path overhead and the bridge ID are elected, the port ID is compared and the port ID is selected as the specified port.
After network convergence, only the specified port and root port can forward data. The other ports are prestaged, blocked, unable to forward data, and can only be received from the specified switch in the connected network segment to monitor the status of the link.

Port status


The port State migration mechanism for STP is shown in the figure, and there are 5 ports on the device that run the STP protocol:
1. Forwarding: Forwarding status. The port can forward both the user traffic and the BPDU message, and only the root port or the specified port can enter the forwarding state.
2. Learning: Learning status. The port builds the MAC address table based on incoming user traffic, but does not forward user traffic. The learning State is added to prevent temporary loops.
3. Listening: Listening status. The port can forward BPDU messages, but cannot forward user traffic.
4. Blocking: Blocking state. The port can only receive and process BPDUs, cannot forward bpdus, and cannot forward user traffic. This state is the final state of the prestaged port.
5. Disabled: Disabled state. The port does not process and forward BPDU messages, nor does it forward user traffic.

BPDUs


In order to compute the spanning tree, the switch refers to exchanging related information and parameters, which are encapsulated in the BPDU (Bridge Protocol Data Unit).
There are two types of BPDUs: Configuration BPDUs and TCN BPDUs.
1. Configuring BPDUs contains parameters such as Bridge ID, path cost, and port ID. The STP protocol elects the root switch by passing configuration BPDUs between switches, and determines the role and status of each switch port. During the initialization process, each bridge is actively sending configuration BPDUs. After the network topology is stable, only the root bridge is actively sending configuration BPDUs, and the other switches send their own configuration BPDUs after receiving upstream configuration BPDUs.
2. TCN BPDUs refer to the topology change notification that the downstream switch sends upstream when the topology changes.
The configuration BPDUs contain enough information to ensure that the device completes the spanning tree calculation, which contains important information such as the following:
Root Bridge ID: consists of the Root bridge's priority and MAC address, and there is only one root in each STP network.
Root Path overhead : The shortest path cost to the root bridge.
Specify Bridge ID: consists of the priority and MAC address of the specified bridge. Specifies the Port ID: consists of the priority and port number of the specified port.
MessageAge: Configures the lifetime in which BPDUs propagate across the network.
* Max age*: Configures the maximum lifetime that BPDUs can hold in a device.
HelloTime: Configures the period in which BPDUs are sent.
ForwardDelay: Delay of port State migration.

Timer


The STP protocol contains some important time parameters, as illustrated here:
1. Hello time refers to the interval at which a device running the STP protocol sends a configuration BPDU to detect a link failure. The switch sends a configured BPDU message to the surrounding switch every hello time to confirm that the link is faulty. When the network topology is stable, this value is only valid if modified on the root bridge.
2. Message Age: If the configuration BPDUs are issued by the root bridge, the message age is 0. Otherwise, Message age is the total time from the root bridge to the current bridge to receive bpdus, including transmission delay. In practice, the message age is incremented by 1 for each switch that is configured for BPDU messages.
3. Max age refers to the aging time of the BPDU message, which can be artificially altered on the root bridge by the command. Max age ensures that Max age is consistent across the entire network by configuring the delivery of BPDUs messages. When a non-root bridge device receives a configured BPDU message, the message age and Max age in the message are compared: If the message age is less than or equal to Max age, the non-root bridge device continues to forward the configuration BPDU message. If the message age is greater than Max, the configured BPDU message will be aged out. The non-root bridge device will discard the configuration BPDUs directly and assume that the network diameter is too large to cause the root bridge connection to fail.

STP topology changes Root bridge failure


In a stable STP topology, the non-root bridge periodically receives BPDU messages from the root bridge. If the root bridge fails and the BPDU message is stopped, the downstream switch cannot receive the BPDU message from the root bridge. If the downstream switch has not received the BPDU message, the Max age timer will time out (the default value of Max age is 20 seconds), resulting in the failure of the received BPDU message, at which point the non-root switch sends each other to configure the BPDU message to re-elect the new root bridge. A root bridge failure results in a recovery time of about 50 seconds, and the recovery time is approximately equal to Max age plus twice times the forward delay convergence time.

Direct link Failure


In this example, SWA and SWB use two link interconnects, one of which is the primary link and the other is the backup link. After the spanning tree is properly convergent, if SWB detects a physical failure of the link to the root port, its alternate port is migrated to the listening, learning, forwarding state and reverts to the forwarding state after twice times of forward delay.

Non-direct link failure


In this case, the link between the SWB does not swa some kind of failure (non-physical layer failure), SWB therefore has not received the BPDU message from SWA. At this point, SWB will think that the root bridge swa no longer valid, so began to send BPDUs message to SWC, notify SWC itself as a new root bridge. SWC will also continue to receive BPDU messages from the original bridge, thus ignoring the BPDU messages sent by SWB. Since the alternate port of SWC can no longer receive bpdus messages containing the original bridge ID. After its Max age timer expires, SWC switches the alternate port to the specified port and forwards the BPDU message from its root port to SWB. SWB abandons the claim to be the root bridge and begins to converge the port as the root port. After a non-direct link failure, the port takes approximately 50 seconds to revert to the forwarding state due to the need to wait for Max age plus twice times the forward delay time.

Topology change causes MAC Address Table error

In a switched network, the switch relies on the MAC address table to forward the data frame. By default, the aging time of the MAC Address table entry is 300 seconds. If the spanning-tree topology changes, the path of the switch forwards the data will also change as the table entries in the MAC Address table that are not aged in time will cause data forwarding errors, so the MAC address table entries need to be updated immediately after the topology changes.
In this example, the MAC Address table entry in SWB defines the port gigabitethernet 0/0/3 can reach host a, and the port gigabitethernet 0/0/1 can reach Host B. Because the root port of SWC is faulty, the spanning tree topology is re-convergent, and the frame from host A to Host B still cannot reach the destination after the spanning-tree topology has finished converging. This is because the MAC Address table entry aging time is 300 seconds, and when host a frames to Host B reach SWB, SWB continues to forward the data frame through the port gigabitethernet 0/0/1.

Topology change causes MAC address table to change


During the topological change process, the root bridge is informed by the TCN BPDU message that a fault occurred in the spanning-tree topology. The root bridge generates a TC used to notify other switches to accelerate aging of existing MAC address table entries.
The specific process for topology changes and MAC Address table entry updates is as follows:
1. SWC is aware that the network topology changes, and will continuously send to SWB TCN
BPDU message.
2. SWB receives a TCN BPDU message from SWC, it sets the TCA bit of flags in the configuration BPDU message to 1, then sends it to the SWC to tell SWC to stop sending the TCN BPDU message.
3. SWB forwards the TCN BPDU message to the root bridge.
4. SWA sets the TC bit of flags in the configuration BPDU message to 1 and notifies the downstream device to change the aging time of the MAC Address table entry from the default of 300 seconds to the time of forwarding delay (15 seconds by default).
5. After a maximum wait of 15 seconds, the error mapping in SWB is automatically cleared. Thereafter, the SWB will be able to correctly forward frames from host A to host B through the G0/0/2 port.

STP Configuration for STP mode


The Huawei X7 series switches support three spanning tree protocol modes.
The STP mode {MSTP | stp | rstp} command is used to configure the spanning-tree protocol mode for the switch. By default, the Huawei X7 series switches work in MSTP mode. The STP mode must be reconfigured before using STP.

Configure switch Priority


Based on the needs of the enterprise business to the network, it is generally recommended to manually specify a high-performance switch in the network as the root bridge.
You can configure the bridge priority to specify the root bridge in the network to ensure that the data traffic inside the enterprise network is forwarded using the optimal path.
The STP Priority precedence command is used to configure the device prioritization value. The priority value is an integer, with a value range of 0 to 61440 and a step of 4096. By default, the priority value of the switching device is 32768. In addition, the root bridge in the spanning tree can be specified through the STP root primary command.

Configure path Overhead


The Huawei X7 Series switches support three path cost standards to ensure compatibility with your friendly devices. By default, the path cost standard is IEEE 802.1t.
The STP pathcost-standard {dot1d-1998 | dot1t | legacy} command is used to configure the criteria for path cost values on the specified switch.
The path cost for each port can also be specified manually. This STP path overhead control method should be used with caution, and manually specifying the path cost of a port may generate a sub-gifted tree topology.
The STP cost costs command depends on the path overhead calculation method:
1. When using Huawei's private computing method, the cost range is 1~200000.
2. When using the IEEE 802.1d standard method, the cost range is 1~65535.
3. When using the IEEE 802.1t standard method, the cost range is 1~200000000.

Configuration verification


The Display STP command is used to check the STP configuration of the current switch. The information in the command output is described below.
The CIST bridge parameter identifies the current bridge ID of the specified switch, including the switch's priority and MAC address.
The Bridge times parameter identifies the value of the Hello Timer, the Forward delay timer, and the Max age timer.
The CIST root/erpc parameter identifies the root bridge ID and the root path overhead for this switch to the root bridge.

The Display STP command displays all port information on the switch, and the Display STP Interface interface command displays the specified port information on the switch. Other information includes port roles, port status, and the protection mechanisms used.

Summarize:
1. After the root bridge has failed, the other switches will be elected as the root bridge, then the original root bridge back to normal, the network will change what happens?
2. What is the difference between path overhead and root path overhead?
For:
1. If the root bridge fails in the spanning tree network, the switch with the highest priority in the other switches will be elected as the new Root bridge. If the original root bridge is activated again, the network will re-elect the new Root bridge based on bid.
2. The root path overhead is the total cost of the path to the root bridge, while the path cost refers to the cost of the switch port.

16.HCNA-HNTD--STP principles and configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.