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.

Pasted image 20240804222153.png

Every bridge (switch) sends out a frame called BPDU (Bridge Protocol Data Units) every seconds

  1. 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
  2. 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
  3. 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
  4. 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
  5. 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
  6. Blocking ports that could cause a loop

Pasted image 20241031202501.png

Consider this example

  1. The system determine that SW1 is the root bridge
  2. Now we find root port
  3. SW1 see that it directly connect with SW2, hence that port becomes RP
  4. Similar to SW3 hence that port becomes RP
  5. Now we find designated port
  6. Designated port are port that leads away from the root bridge
    1. Root Port (RP) leads towards to root bridge
    2. Designated Port (DP) leads away from root bridge
  7. Therefore the ports on the Root bridge are all designated port since they're going away
  8. 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)
    1. SW3 and SW2 will compare the cost BPDUs. Which one has a better cost. In this case, lets assume SW3
    2. Therefore SW3 becomes DP and block SW2

State

A port can ahve different state.

  1. Initializing: Port has just been power on
  2. Blocking: port in this state is unused. Does not forward or receive frames. However it still:
    1. Receive and process BPDU (Bridge Protocol Data Units)
    2. Receive and responds to messages related to network management
  3. Listening: Similar to blocking state, BPDU (Bridge Protocol Data Units) are sent as well as receive. No addresses are learn.
  4. Forwarding: Normal state, receive and send BPDU (Bridge Protocol Data Units) and other traffic and MAC information
  5. Disabled: Does not participate in STP (Spanning Tree Protocol), does not use. Only receive and response to network management messages

Also see: