Spanning-Tree Protocol (STP) as defined in the IEEE 802.1D is a link management protocol that provides path redundancy while preventing undesirable loops in the network. For an Ethernet network to function properly, only one active path can exist between two stations. Loops occur in networks for a variety of reasons. The most common reason you find loops in networks is the result of a deliberate attempt to provide redundancy -in case one link or switch fails, another link or switch can take over.
STP is a technology that allows bridges to communicate with each other to discover physical loops in the network. The protocol then specifies an algorithm that bridges can use to create a loop-free logical topology. In other words, STP creates a tree structure of loop-free leaves and branches that spans the entire Layer 2 network.
Spanning-Tree Protocol operation is transparent to end stations, which are unaware whether they are connected to a single LAN segment or a switched LAN of multiple segments. Where two bridges are used to interconnect the same two computer network segments, spanning tree is a protocol that allows the bridges to exchange information so that only one of them will handle a given message that is being sent between two computers within the network.
Bridge Protocol Data Units (BPDUs) is used by bridges in a network to exchange information regarding their status. The Spanning-Tree Protocol uses the BPDU information to elect the root switch and root port for the switched network, as well as the root port and designated port for each switched segment.
The program in each bridge that allows it to determine how to use the protocol is known as the spanning tree algorithm, which is specifically constructed to avoid bridge loops. The algorithm is responsible for a bridge using only the most efficient path when faced with multiple paths. If the best path fails, the algorithm recalculates the network and finds the next best route.
The spanning tree algorithm determines the network (which computer hosts are in which segment) and this data is exchanged using Bridge Protocol Data Units (BPDUs). It is broken down into two steps:
Step 1: The algorithm determines the best message a bridge can send by evaluating the configuration messages it has received and choosing the best option.
Step 2: Once it selects the top message for a particular bridge to send, it compares its choice with possible configuration messages from the non-root-connections it has. If the best option from step 1 isn"t better than what it receives from the non-root-connections, it will prune that port.
Protocol Structure
The Bridge Protocol Data Units (BPDUs).
| Protocol ID (2) | Version (1) | Type (1) | Flags (1) | Rood ID (8) | Root Path (4) |
| Sender BID (8) | Port ID (2) | M-Age (2) | Max Age (2) | Hello (2) | FD (2 Bytes) |
- Protocol ID -Always 0.
- Version -Always 0.
- Type -Determines which of the two BPDU formats this frame contains (Configuration BPDU or TCN BPDU).
- Flags -Used to handle changes in the active topology and is covered in the next section on Topology Change Notifications.
- Root BID -Contains the Bridge ID of the Root Bridge. After convergence, all Configuration BPDUs in the bridged network should contain the same value for this field (for a single VLAN). NetXRay breaks out the two BID subfields: Bridge Priority and bridge MAC address.
- Root Path Cost -The cumulative cost of all links leading to the Root Bridge.
- Sender BID -The BID of the bridge that created the current BPDU. This field is the same for all BPDUs sent by a single switch (for a single VLAN), but it differs between switches.
- Port ID -Contains a unique value for every port. Port 1/1 contains the value 0-8001, whereas Port 1/2 contains 0-8002.
- Message Age -Records the time since the Root Bridge originally generated the information that the current BPDU is derived from.
- Max Age -Maximum time that a BPDU is saved. Also influences the bridge table aging timer during the Topology Change Notification process (discussed later).
- Hello Time -Time between periodic Configuration BPDUs.
- Forward Delay -The time spent in the Listening and Learning states. Also influences timers during the Topology Change Notification process (discussed later).
Related protocols: IEEE 802.1D, 802.3, 802.1Q
Sponsor Source: STP is defined by IEEE (http://www.ieee.org) 802.1D.
Reference:
http://standards.ieee.org/getieee802/download/802.1D-1998.pdf: ANSI/IEEE Std 802.1D 1998 Edition
http://www.cisco.com: Understanding Spanning Tree Protocol
