STP (Spanning Tree Protocol)
To prevent Switching Loop
Each switch participate in this STP process will be assigned a STP bridge ID (BID
)
The info shared via STP is called BPDU (Bridge Protocol Data Units)
Convergence (Creating a tree)
Works by creating a tree.
Every bridge (switch) sends out a frame called BPDU (Bridge Protocol Data Units) every seconds
- Select a root bridge (switch)
- Determine by switch with lowest
BID
BID = Bridge priority + MAC address
- Bridge priority = 2 byte fields. Default value = 32768
RootID = root priority + mac address
. Root priority is also 32768 by default.- When a switch boots, it assume that it's the root and set its
rootId = Bridge Id
- Determine by switch with lowest
- Calculate the shortes path from each switch to the root bridge
- If the BPDU (Bridge Protocol Data Units) from the root bridge are received on more than one port, there are more than one path to the root bridge.
- In this case, we consider the part with the lowest cost
- The cost is determine by adding each
bridge's priority
- The cost is determine by adding each
- Determine the root port on each bridge
- The root port is the port on the switch that has the shortest path to the root bridge
- The root bridge does not have the root port, the root bridge only has desginated port
- Determine the designated port on each segment (segment could be a link or a group etc)
- designated port are the port that are on the shortest part but move traffic away from the root bridge
- Elect a designated bridge on each segment
- Designated bridge are switches that contains designated port
- The root bridge is the designated bridge for all directly segment
- Blocking ports that could cause a loop
- Ports that have received BPDU (Bridge Protocol Data Units) that are not designated nor root ports are blocked
Consider this example
- The system determine that SW1 is the root bridge
- Now we find root port
- SW1 see that it directly connect with SW2, hence that port becomes RP
- Similar to SW3 hence that port becomes RP
- Now we find designated port
- Designated port are port that leads away from the root bridge
- Root Port (RP) leads towards to root bridge
- Designated Port (DP) leads away from root bridge
- Therefore the ports on the Root bridge are all designated port since they're going away
- Now between SW3 and SW2 we need to choose 1 DP only since if we have both DP there will be a loow (SW1 -> SW2 -> SW3 -> SW1)
- SW3 and SW2 will compare the cost BPDUs. Which one has a better cost. In this case, lets assume SW3
- Therefore SW3 becomes DP and block SW2
State
A port can ahve different state.
- Initializing: Port has just been power on
- Blocking: port in this state is unused. Does not forward or receive frames. However it still:
- Receive and process BPDU (Bridge Protocol Data Units)
- Receive and responds to messages related to network management
- Listening: Similar to blocking state, BPDU (Bridge Protocol Data Units) are sent as well as receive. No addresses are learn.
- Forwarding: Normal state, receive and send BPDU (Bridge Protocol Data Units) and other traffic and MAC information
- Disabled: Does not participate in STP (Spanning Tree Protocol), does not use. Only receive and response to network management messages
Also see: