Spanning Tree Protocol (STP)
Concept
Broadcasting might cause Switching Loop, and the goal of STP is to prevent this kind of problem
Ports
Root Port
Fore each switch, the port which connects the fastest path to root switch is the root port
Designated Port
For every switch, we’ll choose the port with the fastest path to root switch as the designated port between the two ports on two sides of the link
Non-Designated Port
All other ports that are in blocking state
States
- Disabled: A port that is shutdown
- Blocking: A port that is blocked, i.e., traffic can’t go through
- Listening: No forwarding traffic and not learning MAC addresses
- Learning: No forwarding traffic but learning MAC addresses
- Forwarding: Act normally
Implementation
1. Choose Root Switch
Switches in LAN should first decide a switch as the root switch. They achieve this by communicating with BPDU protocol
The switch with the largest priority number + VLAN ID will be the root bridge. If they are the same, the switch with smallest MAC address will be the root bridge
2. Choose Root Port
Choose root port by its definition
3. Choose Designated Port
For every links, we’ll choose its designated port
Every port of root switch is designated port because its distance is zero
4. Set States
Every root switch’s port is set to forwarding state. Non-designated ports are set to blocking state