Spanning Tree Protocol
Sometimes on a network, extra bridges and/or switches are added in order to provide redundant paths for fault tolerance. Thus if one path becomes unavailable then an alternative path may be used. However, when bridges or switches are connected together such that there are redundant paths, there is the possibility of creating loops. To understand this, consider the diagram below:-

There are two paths from Host A to Host C , one path through Switch 1 and another path through Switch 2. This path redundancy is useful if one of the switches stops functioning since there is alternative path for network traffic. However, this redundancy could also cause broadcast storms and address table filtering instability.
~~ Broadcast Storm ~~
Broadcast Storms, where switches endlessly flood broadcast frames to all ports, are a possibility when redundant paths exist on a network. The STP mechanism is required to prevent this. Consider the diagram below:-

When Host A sends a broadcast frame, such as an ARP request, the frame will be received by both Switch 1 and Switch 2. When Switch 1 receives the frame, it is identified as a broadcast message since the destination MAC address field contains the broadcast address FF:FF:FF:FF:FF:FF. It then floods the frame to Segment Y , which also contains Switch 2.
When the broadcast frame arrives at Switch 2 , the switch repeats the process and floods it to Segment X , which also contains Switch 1. When Switch 1 receives the frame, it will flood it again. Thus, the broadcast frame will endlessly travel around around the network, from switch to switch.
~~ Address Table Filtering Instability ~~
Address table filtering instability is another problem that might occur when redundant paths exist on a network. Consider the diagram below:-

When Host A sends a message to Host B, the frame will be received by both Switch 1 and Switch 2.
Suppose Switch 1 does not yet have an entry for Host B in it's MAC address table. It then floods the frame to all segments.
When Host B receives the frame and replies to it, Switch 1 will deduce Host B is on port 1 on Segment X and create a MAC address entry >> Host B is on port 1.
In the meantime, Switch 2 also receives the frame, does not yet have an entry for Host B in it's MAC address table either and so floods the frame to all segments.
When Switch 1 receives a copy of the frame from Switch 2 on port 2, it removes the MAC address entry >> Host B is on port 1>> and replaces it with >> Host B is on port 2.
Thus Switch 1 is now incorrect about which segment Host B is located on.
~~ STP in Operation ~~
Spanning Tree Protocol (STP) is a a protocol designed to eliminate redundant paths and loops on a network. The specification for STP is defined in IEEE 802.1d.
STP works as follows...
Switches and bridges exchange special messages called Bridge Protocol Data Units (BPDUs) to inform each other of their existence. The purpose is these BPDUs is to decide which ports should remain open, which should be blocked to avoid loops and to elect a root bridge (which you can imagine as the king amongst bridges/switches.)
Here is an example of a BPDU.
| Sender BID |
8000:ABCDEF123456 |
| Root Path Cost |
100 |
| Root BID |
8000:123456ABCDEF |
| Port ID |
1 |
At the beginning, each bridge/switch assumes that it is the root bridge and sends a BPDU out of all of its ports, advertising itself as the root bridge. The diagram below shows each switch sending out such a BPDU. You should note that in reality, a different BPDU is sent of each switch port, unless the port is disabled.
A BPDU contains a bridge ID (BID) field. An election is held where the bridge or switch with the lowest Bridge ID is elected the root bridge. All the ports on a root bridge are then marked as designated ports that are allowed to forward MAC addresses.
When the root bridge is elected, all the other bridges/switches decide which of their own ports will be used to connect to the root bridge. This will be the port with the least path cost to use and is known as the root port. Path costs, as shown in the table below, depend on the bandwidth of the link on that port. If two ports have the same path cost, the lowest numbered port is chosen.
| INTERFACE TYPE |
BANDWIDTH |
PORT PATH COST |
| 56K Serial |
56,000 bits/sec |
17857 |
| 10M Ethernet |
10,000,000 bits/sec |
100 |
| FDDI |
100,000,000 bits/sec |
10 |
In the diagram below, Switch 1 has been elected the root bridge. Switch 2 has decided that port 1 has the least path cost and so that port becomes the root port. Switch 3 also decided port 1 is its root port.

Now that the root ports have been decided on, which of the switches in the diagram do you think should forward traffic onto Segment Z? If both of them are allowed to forward frames, then a loop would form. One switch's port 2 should be allowed to forward frames (acting as a designated port), while the other switch's port 2 should be disabled.
On non-root bridges only one port can be designated, all others are blocked. Only designated ports forward MAC addresses. Designated ports are selected based on the lowest path cost to the root bridge for a segment.
In the diagram below, the designated port for Segment Z is port 2 on Switch 2. Port number 2 on Switch 3 has been disabled. Any traffic destined for that segment would be forwarded through Switch 2 only.

Thus the STP mechanism ensures that redundant links are closed down. Of course, any redundant link can be opened again. This would be necessary, for example, if the network topology changed.
At any time bridge and switch ports running STP can be in one of following four modes:
- Blocking - a port in this state sends and receives BPDUs but will not forward frames. When bridges/switches are turned on they are in this state; it is the default state.
- Listening - a port in this state listens to BPDUs to ensure there are no loops. Frames are not forwarded when in this state.
- Learning - a port in this state learns about MAC addresses and builds a MAC address table. Frames are not forwarded when in this state.
- Forwarding - a port in this state sends and receives frames. BPDUs are still sent and received.
- Disabled - a port in this state does not forward frames or send/receive BPDUs.
~~Activity~~
| Activity A |
Examine the picture below. Six switches are show, connecting together six LAN segments. The root bridge is Switch 1. You may assume the path cost of each switch is the same as the number in its name, e.g. Switch 1 has a path cost of 1, Switch 2 has a path cost of 2, etc.
- Decide which port of each switch would be assigned as the root port.
- Decide if port 2 on Switch 3 or port 2 on Switch 4 would be assigned as the designated port for Segment 3.
- Decide if port 3 on Switch 5 or port 2 on Switch 6 would be assigned as the designated port for Segment 3.

1. Where are the root ports? 2. Where are the designated ports? |
|