STP – SpanningTree Protocol was originally developed as a proprietary protocol by DEC (Digital Equipment Corporation), with most of the early R & D being performed by Radia Perlman. It was seen to be such an important protocol that the IEEE adopted the protocol, revised it and it then became part of the IEEE 802 specification, precisely IEEE 802.1d. Almost all manufacturers of layer 2 switching equipment today support the revised 802.1d standard.
This standard revolutionised layer 2 switching when numbers of switches had to be connected together to create a Local Area Network. Spanning-Tree is designed to automatically detect any routing loops and temporarily block certain ports in order to break the loops.
The Spanning Tree Protocol operates by blocking traffic on any redundant links in the network to break loops, but then reopen those links if a port or device should fail.
The process starts by all inter-connected switches electing what is known as a “Root Bridge”, the term Bridge coming from the devices that switches superseded. Ports on the Root Bridge are referred to as “Designated Ports” and are allowed to forward traffic. Non Route Bridges will have a single port designated as a “Root Port” which is designed to provide a connection to the Root Bridge. When powered on, each switch sends out what are known as BPDUs (Bridge Protocol Data Units) which are small frames containing the Bridge Identity. Switches forward these BPDUs out of every active trunk port, so all switches are aware of other switches in the network.
The Root Bridge is elected by means of the lowest Bridge ID, which is a combination of a Bridge Priority and the base MAC Address. The switch with the lowest Bridge ID becomes the Root and all other switches have a Root Port which connects to the Root Bridge. This is determined by the least cost path to the Root Bridge. Ports on any switch in the network will either be a Root Port, Designated Port or Non-Designated Port. Non-Designated port will often be in blocking state to break rooting loops.
For any pair of network segments, there must be a pair of designated ports designed to allow traffic to flow from one network segment to another. If there is more than a single pair of ports interconnecting two network segments then all but one pair will be placed in blocking mode.
A switch listens for BPDUs from the Root Bridge on the Root Port and from neighbouring switches on Designated Ports. The BPDUs are sent by every switch every 2 seconds and when a switch fails to hear BPDUs for 10 x the interval period (20 seconds), it starts a Spanning-Tree re-calculation. The 20 second period is known as the MAXAGE. If a switch determines it must open up a Blocking Port to maintain communications then it goes through a series of transitions before actually opening up the Blocking Port for traffic.
After Blocking, the switch transitions to Listening State where it is listening for BPDUs to determine which other switches are still available and which switch should be the Root Bridge. This period is 15 seconds and during this period the MAC Address Table is not populated with MAC Addresses from frames received. The switch not transitions to Learning State when it starts to rebuild the MAC Address Table, but still does not forward operational frames. Eventually the relevant ports full transition to forwarding and the network has said to have converged. It is possible to alter the timers for MAXAGE and the transitional Forward Delay periods, but they are normally left to default values.
Essentially if you connect a number of layer 2 switches together to create a network, Spanning-Tree will normally be switched on by default on those switches and will automatically provide the Loop Avoidance mechanism required to ensure data frames are not looped. It is possible to alter certain parameters such as the Bridge ID to force certain switches to be the Root Bridge so that you can have predictable outcomes when ports or entire switches fail in the network.
In later articles we will discuss this further and also discuss a revision to the IEEE 802.1d Spanning-Tree standard known as RSTP (Rapid Spanning Tree Protocol) or IEEE 802.1w.
The information contained in this article is discussed and practiced during some of our Public Scheduled and On-Site training courses.