Principles of STP/RSTP

420 0 0 0

This section describes principles of STP/RSTP.

Background

STP is used to prevent loops in the LAN. The switching devices running STP discover loops on the network by exchanging information with one another, and block certain interfaces to cut off loops. Along with the growth of the LAN scale, STP has become an important protocol for the LAN.

Figure 7-27  Networking diagram for a typical LAN 
imgDownload?uuid=acbe2f79fc34494fb81c045
On the network shown in Figure 7-27, the following situations may occur:

  • Broadcast storms render the network unavailable.

    Loops lead to broadcast storms, which causes network breakdown. Broadcast storms In Figure 7-27, assume that STP is not enabled on the switching devices. If Host A broadcasts a request, the request is received by port 1 and forwarded by port 2 on S1 and S2. Then, again on S1 and S2, port 2 receives the request broadcast by the other and port 1 forwards the request. As such transmission repeats, resources on the entire network are exhausted, causing the network unable to work.

  • Flapping of MAC address tables damages MAC address entries.

    Even update of MAC address entries upon the receipt of unicast packets damages the MAC address table.

    Assume that no broadcast storm occurs on the network. Host A unicasts a packet to Host B. If Host B is temporarily removed from the network at this time, the MAC address entries of Host B on S1 and S2 are deleted. The packet unicast by Host A to Host B is received by port 1 on S1. S1, however, does not have associated MAC address entries. Therefore, the unicast packet is forwarded to port 2. Then, port 2 on S2 receives the unicast packet from port 2 on S1 and sends it out through port 1. As such transmission repeats, port 1 and port 2 on S1 and S2 continuously receive unicast packets from Host A. Therefore, S1 and S2 modify the MAC address entries continuously, causing the MAC address table to flap. As a result, MAC address entries are damaged.

Basic Concepts

One Root Bridge

A tree topology must have a root. Therefore, the root bridge is introduced by STP.

There is only one root bridge on the entire STP-capable network. The root bridge is the logical center of but is not necessarily at the physical center of the entire network. The root bridge changes dynamically with the network topology.

After the network converges, the root bridge generates and sends out configuration BPDUs at specific intervals. Other devices process the configuration BPDUs so that the configuration BPDUs are advertised to the entire network, ensuring a stable network.

Two Types of Measurements

The spanning tree is calculated based on two types of measurements: ID and path cost.

  • ID

    IDs are classified into Bridge IDs (BIDs) and Port IDs (PIDs).

    • BID

      IEEE 802.1D defines that a BID is composed of a 16-bit bridge priority and a bridge MAC address. The bridge priority occupies the leftmost 16 bits and the MAC address occupies the rightmost 48 bits.

      On an STP-capable network, the device with the smallest BID is selected to be the root bridge.

    • PID

      The PID is composed of a 4-bit port priority and a 12-bit port number. The port priority occupies the leftmost 4 bits and the port number occupies the rightmost 12 bits.

      The PID is used to select the designated port.

      imgDownload?uuid=28be1c69d7d14f83aed96f5 NOTE:

      The port priority affects the role of a port in a specified spanning tree instance. For details, see STP Topology Calculation.

  • Path cost

    The path cost is a port variable and is used to select a link. STP calculates the path cost to select a robust link and blocks redundant links to trim the network into a loop-free tree topology.

    On an STP-capable network, the accumulative cost of the path from a certain port to the root bridge is the sum of the costs of all the segment paths into which the path is separated by the ports on the transit bridges. This value is also called root path cost.

Three Elements

There are generally three elements used when a ring topology is to be trimmed into a tree topology: root bridge, root port, and designated port. Figure 7-28 shows the three elements.

Figure 7-28  STP network architecture 
imgDownload?uuid=ad5c1c73200e43fca6f5ff6

  • Root bridge

    The root bridge is the bridge with the smallest BID. The smallest BID is discovered by exchanging configuration BPDUs.

  • Root port

    The root port is the port with the smallest root path to the root bridge, and is responsible for forwarding data to the root bridge. The root port is determined based on the path cost. Among all STP-capable ports on a network bridge, the port with the smallest root path cost is the root port. There is only one root port on an STP-capable device, but there is no root port on the root bridge.

  • Designated port

    For description of the designated bridge and designated port, see Table 7-17.

    Table 7-17  Description of the designated bridge and designated port

    Object

    Designated Bridge

    Designated Port

    Device

    Device that forwards configuration BPDUs to a directly connected device

    Designated bridge port that forwards configuration BPDUs to a device

    LAN

    Device that forwards configuration BPDUs to a network segment

    Designated bridge port that forwards configuration BPDUs to a network segment.

    As shown in Figure 7-29, AP1 and AP2 reside on S1; BP1 and BP2 reside on S2; CP1 and CP2 reside on S3.

    • S1 sends configuration BPDUs to S2 through AP1. S1 is the designated bridge of S2, and AP1 on S1 is the designated port.

    • Two devices, S2 and S3, are connected to the LAN. If S2 is responsible for forwarding configuration BPDUs to the LAN, S2 is the designated bridge of the LAN and BP2 on S2 is the designated port.

    Figure 7-29   Networking diagram of the designated bridge and designated port 
    imgDownload?uuid=f012ae6dce3d4c00babc367

After the root bridge, root port, and designated port are selected successfully, the entire tree topology is set up. When the topology is stable, only the root port and the designated port forward traffic. All the other ports are in the Blocking state and receive only STP protocol packets instead of forwarding user traffic.

Four Comparison Principles

STP has four comparison principles that form a BPDU priority vector { root BID, total root path costs, sender BID, port ID }.

Table 7-18 shows the port information that is carried in the configuration BPDUs.

Table 7-18  Four important fields

Field

Brief Description

Root BID

Each STP-capable network has only one root bridge.

Root path cost

The distance between the port sending configuration BPDUs to the root bridge determines the path cost to the root bridge.

Sender BID

BID of the device sending configuration BPDUs.

Port ID

PID of the port sending configuration BPDUs.

After a device on the STP-capable network receives configuration BPDUs, it compares the fields shown in Table 7-18 with that of the configuration BPDUs on itself. The four comparison principles are as follows:

imgDownload?uuid=28be1c69d7d14f83aed96f5 NOTE:

During the STP calculation, the smaller the value, the higher the priority.

  • Smallest BID: used to select the root bridge. Devices running STP select the smallest BID as the root BID shown in Table 7-18.
  • Smallest root path cost: used to select the root port on a non-root bridge. On the root bridge, the path cost of each port is 0.
  • Smallest sender BID: used to select the root port when a device running STP selects the root port between two ports that have the same path cost. The port with a smaller BID is selected as the root port in STP calculation. Assume that the BID of S2 is smaller than that of S3 in Figure 7-28. If the path costs in the BPDUs received by port A and port B on S4 are the same, port B becomes the root port.
  • Smallest PID: used to block the port with a greater PID but not the port with a smaller PID when the ports have the same path cost. The PIDs are compared in the scenario shown in Figure 7-30. The PID of port A on S1 is smaller than that of port B. In the BPDUs that are received on port A and port B, the path costs and BIDs of the sending devices are the same. Therefore, port B with a greater PID is blocked to cut off loops.Figure 7-30  Topology to which PID comparison is applied 
    imgDownload?uuid=3a25207290eb431bbe2fc77

Five Port States

Table 7-19 shows the port status of an STP-capable device.

Table 7-19  STP Port states

Port State

Purpose

Description

Forwarding

A port in Forwarding state can forward user traffic and process BPDUs.

Only the root port and designated port can enter the Forwarding state.

Learning

When a device has a port in the Learning state, the device creates a MAC address table based on the received user traffic but does not forward user traffic.

This is a transitional state, which is designed to prevent temporary loops.

Listening

All ports are in the Listening state when STP calculation is being implemented to determine port roles.

This is a transitional state.

Blocking

A port in the Blocking state receives and forwards only BPDUs, not user traffic.

This is the final state of a blocked port.

Disabled

A port in Disabled state does not process BPDUs or forward user traffic.

The port is Down.

Figure 7-31 shows the process of the state transition of a port.

Figure 7-31   STP State transition of a port 
imgDownload?uuid=67a217e725204d21af08fd7
imgDownload?uuid=a15da1ad53514cbd9a1aa01

A Huawei datacom device uses MSTP by default. After a device transitions from the MSTP mode to the STP mode, its STP-capable port supports the same port states as those supported by an MSTP-capable port, including the Forwarding, Learning, and Discarding states. For details, see Table 7-20.

Table 7-20  MSTP Port status

Port Status

Description

Forwarding

A port in Forwarding state can forward user traffic and process BPDUs.

Learning

A port in Learning state learns MAC addresses from user traffic to construct a MAC address table.

In Learning state, the port can send and receive BPDUs, but does not forward user traffic.

Discarding

A port in the Discarding state can only receive BPDUs.

The following parameters affect the STP-capable port states and convergence.

  • Hello time

    The Hello timer specifies the interval at which an STP-capable device sends configuration BPDUs and Hello packets to detect link faults.

    When the network topology becomes stable, the change made on the interval takes effect only after a new root bridge takes over. The new root bridge adds certain fields in BPDUs to inform non-root bridges of the change in the interval. After a topology changes, TCN BPDUs will be sent. This interval is irrelevant to the transmission of TCN BPDUs.

  • Forward Delay

    The Forward Delay timer specifies the delay for interface status transition. When a link fault occurs, STP recalculation is performed, causing the structure of the spanning tree to change. The configuration BPDUs generated during STP recalculation cannot be immediately transmitted over the entire network. If the root port and designated port forward data immediately after being selected, transient loops may occur. Therefore, an interface status transition mechanism is introduced by STP. The newly selected root port and designated port do not forward data until an amount of time equal to twice the forward delay has past. In this manner, the newly generated BPDUs can be transmitted over the network before the newly selected root port and designated port forward data, which prevents transient loops.

    imgDownload?uuid=28be1c69d7d14f83aed96f5 NOTE:

    The Forward Delay timer specifies the duration of a port spent in both the Listening and Learning states. The default value is 15 seconds. This means that the port stays in the Listening state for 15 seconds and then stays in the Learning state for another 15 seconds. The port in the Listening or Learning state is blocked, which is key to preventing transient loops.

  • Max Age

    The Max Age time specifies the aging time of BPDUs. The Max Age time can be manually configured on the root bridge.

    Configuration BPDUs are transmitted over the entire network, ensuring a unique Max Age value. After a non-root bridge running STP receives a configuration BPDU, the non-root bridge compares the Message Age value with the Max Age value in the received configuration BPDU.
    • If the Message Age value is smaller than or equal to the Max Age value, the non-root bridge forwards the configuration BPDU.
    • If the Message Age value is larger than the Max Age value, the configuration BPDU ages and the non-root bridge directly discards it. In this case, the network size is considered too large and the non-root bridge disconnects from the root bridge.
    imgDownload?uuid=28be1c69d7d14f83aed96f5 NOTE:

    If the configuration BPDU is sent from the root bridge, the value of Message Age is 0. Otherwise, the value of Message Age indicates the total time during which a BPDU is sent from the root bridge to the local bridge, including the delay in transmission. In real world situations, each time a configuration BPDU passes through a bridge, the value of Message Age increases by 1.

Table 7-21 shows the timer values defined in IEEE 802.1D.

Table 7-21  Values of STP parameters (in centisecond)

Parameter

Default Value

Value Range

Hello time

200

100-1000

Max Age

2000

600-4000

Forward Delay

1500

400-3000


  • x
  • convention:

Reply

Reply
You need to log in to reply to the post Login | Register

Notice Notice: To protect the legitimate rights and interests of you, the community, and third parties, do not release content that may bring legal risks to all parties, including but are not limited to the following:
  • Politically sensitive content
  • Content concerning pornography, gambling, and drug abuse
  • Content that may disclose or infringe upon others ' commercial secrets, intellectual properties, including trade marks, copyrights, and patents, and personal privacy
Do not share your account and password with others. All operations performed using your account will be regarded as your own actions and all consequences arising therefrom will be borne by you. For details, see " Privacy."
If the attachment button is not available, update the Adobe Flash Player to the latest version!
Login and enjoy all the member benefits

Login and enjoy all the member benefits

Login