The BID, path cost, and PID are all carried in BPDUs.
Configuration BPDUs are heartbeat packets. STP-enabled designated ports send BPDUs at intervals specified by the Hello timer.
TCN BPDUs are sent only after the device detects network topology changes.
A BPDU is encapsulated into an Ethernet frame. In an Ethernet frame, the destination MAC address is the multicast MAC address 01-80-C2-00-00-00; the value of the Length/Type field is the length of MAC data; in the LLC header, as defined in the IEEE standard, the values of DSAP and SSAP are 0x42 and the value of Control is 0x03; the BPDU header follows the LLC header. Figure 1 shows the format of an Ethernet frame.
Figure 1 Format of an Ethernet frame

Configuration BPDUs are most commonly used.
During initialization, each bridge actively sends configuration BPDUs. After the network topology becomes stable, only the root bridge actively sends configuration BPDUs. Other bridges send configuration BPDUs only after receiving configuration BPDUs from upstream devices. A configuration BPDU is at least 35 bytes long, including the parameters such as the BID, path cost, and PID. A BPDU is discarded if both the sender BID and Port ID field values are the same as those of the local port. Otherwise, the BPDU is processed. In this manner, BPDUs containing the same information as that of the local port are not processed.
Table 1 shows the format of a BPDU.
Table 1 BPDU format
Field | Byte | Description |
Protocol Identifier | 2 | Always 0 |
Protocol Version Identifier | 1 | Always 0 |
BPDU Type | 1 | Indicates the type of a BPDU. The value is one of the following:
0x80: TCN BPDU |
Flags | 1 | Indicates whether the network topology is changed.
The leftmost bit is the Topology Change Acknowledgement (TCA) flag. |
Root Identifier | 8 | Indicates the BID of the current root bridge. |
Root Path Cost | 4 | Indicates the cumulative cost of all links to the root bridge. |
Bridge Identifier | 8 | Indicates the BID of the bridge sending a BPDU. |
Port Identifier | 2 | Indicates the ID of the port sending a BPDU. |
Message Age | 2 | Records the time since the root bridge originally generated the information that a BPDU is derived from. 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. |
Max Age | 2 | Indicates the maximum time that a BPDU is saved. |
Hello Time | 2 | Indicates the interval at which BPDUs are sent. |
Forward Delay | 2 | Indicates the time spent in the Listening and Learning states. |
Figure 2 shows the Flags field. Only the leftmost and rightmost bits are used in STP.
Figure 2 Format of the Flags field

A configuration BPDU is generated in one of the following scenarios:
Once the ports are enabled with STP, the designated ports send configuration BPDUs at intervals specified by the Hello timer.
When a root port receives configuration BPDUs, the device where the root port resides sends a copy of the configuration BPDUs to the specified ports on itself.
When receiving a configuration BPDU with a lower priority, a designated port immediately sends its own configuration BPDUs to the downstream device.
The contents of TCN BPDUs are quite simple, including only three fields: Protocol ID, Version, and Type, as shown in Table 1. The value of the Type field is 0x80, four bytes in length.
TCN BPDUs are transmitted by each device to its upstream device to notify the upstream device of changes in the downstream topology, until they reach the root bridge. A TCN BPDU is generated in one of the following scenarios:
Where the port is in the Forwarding state and at least one designated port resides on the device
Where a designated port receives TCN BPDUs and sends a copy to the root bridge
You can check
STP/RSTP Basic Concepts Part I



