An STP switch generates, sends, receives, and processes STP frames, which are a type of multicast frame that contains the multicast address 01-80-c2-00-00-00. The switch establishes and maintains an STP tree through STP frames and reestablishes a new STP tree if the network’s physical topology changes.
STP frames use the IEEE 802.3 encapsulation format, with a payload data known as a BPDU. The two types of BPDU are configuration BPDUs and Topology Change Notification (TCN) BPDUs.
GE0/0/3 GE0/0/1 GE0/0/2 GE0/0/1 GE0/0/1 GE0/0/2 GE0/0/2 S3 S2 S1 Designated port Root port Root bridge Designated port Root port Designated port LAN1 GE0/0/4 Designated port Loop Alternate port Alternate port
Fig. 4.10 Alternate port blocking
4.3.1
Configuration BPDUs
During the initial STP tree generation process, STP switches periodically (every 2 s by default) generate and send configuration BPDUs. During periods in which an established STP tree is stable, only the root bridge periodically (every 2 s by default) generates and sends configuration BPDUs. Likewise, non-root switches periodically receive configuration BPDUs from their root ports and immediately generate their own configuration BPDUs, which the switches send from their designated port. This process is equivalent to the root bridge’s configuration BPDUs traversing other switches one-by-one.
Table4.2describes the format of BPDUs.
Configuration BPDU parameters can be divided into three types:
• The BPDU’s own identifiers, including the protocol identifier, version number, BPDU type, andflags.
Table 4.2 BPDU format
Field Length (Bytes) Description Protocol identifier 2 Always 0x0000 Protocol version identifier 1 Always 0x00
BPDU type 1 0x00, indicates a configuration BPDU
0x80, indicates a TCN BPDU
Flags 1 Network topology changeflag: Uses the least significant and
most significant bits
Least significant bit is the topology change (TC) flag Most significant bit is the TC acknowledgment (TCA) flag
Root identifier 8 Current root bridge BID
Root path cost 4 RPC of the port that sends the BPDU
Bridge identifier 8 BID of the switch that sends the BPDU Port identifier 2 PID of the port that sends the BPDU
Message Age 2 Age of BPDU message
This refers to the total time required to send a certain configuration BPDU from the root bridge up until it arrives at the current switch, including transmission delays. If a configuration BPDU is sent from a root bridge, the Message Age is 0. Otherwise, the Message Age is equal to the period from when the BPDU was sent by the root bridge to when the BPDU is received by the current bridge, including transmission delays. In live networks, the Message Age increases by one for each bridge the configuration BPDU traverses
(continued)
• The parameters used in STP computing, including the BID of the switch that sends the BPDU and the current root bridge, and the RPC and PID of the port that sends the BPDU.
• Time parameters, which are Hello Time, Forward Delay, Message Age, and Max Age.
4.3.2
TCN BPDUs
In terms of their structure and content, TCN BPDUs are simple. They contain only the protocol identifier, version number, and type fields (the first three fields listed in Table4.2).
If the failure of a network link causes the topology to change, the switch located at the point of failure detects this change through the port state. Other switches,
Table 4.2 (continued)
Field Length
(Bytes)
Description
Max Age 2 BPDU’s maximum lifecycle for configuration BPDUs
The value of the Max Age is designated by the root bridge and set to 20 s by default. Once the STP switch receives a configuration BPDU, it will compare the Message Age and Max Age. If the Message Age is less than or equal to the Max Age, the configuration BPDU will trigger the switch to generate and send a new configuration BPDU. Otherwise, the configuration BPDU will be discarded (ignored) and will not trigger the switch to generate and send a new configuration BPDU
Hello Time 2 The interval at which the root bridge and other switches send configuration BPDUs. The default value of Hello time is 2 s Once the network topology and STP tree are stable, the entire network will use the Hello Time of the root bridge. To change this parameter, you must change it on the root bridge Forward Delay 2 The time for which a port remains in the listening and
learning state
This parameter is used to defer the transition to the forwarding state of a port. It requires a certain amount of time to generate an STP tree. During this process, the switch’s port state will change, but may not simultaneously. If a new root port and designated port are elected and immediately begin to forward user data frames, it may lead to a temporary loop. For this, STP has introduced the Forward Delay mechanism: only after two times the Forward Delay can the newly selected root port and designated port enter the forwarding state to forward user data frames. This guarantees that the topology is loop-free at this time
however, cannot directly detect this change. The switch located at the point of failure constantly sends TCN BPDUs to its upstream switch through its root port, at the interval of Hello Time, until it receives a configuration BPDU (with TCA flag set to 1) sent from the upstream switch. After receiving the TCN BPDU, the upstream switch replies with configuration BPDUs (with TCA flag set to 1) through its designated port and constantly sends TCN BPDUs at the interval of Hello Time to its own upstream switch through its root port. This process is repeated until the root bridge receives the TCN BPDU. Upon receipt of the TCN BPDU, the root bridge sends a configuration BPDU (with TC flag set to 1) to notify all other switches about the network topology change. Figure4.11illustrates this process.
After receiving the configuration BPDU whose TC flag is set to 1, the switch learns of the network topology change. This change may mean the content of the switch’s MAC address table is incorrect. As a result, the switch reduces its aging time (300 s by default) to the length of the Forward Delay (15 s by default), which accelerates the aging of the original entries in the MAC address table.