Spanning Tree Election
How does STP works?
Spanning Tree Protocol – A network protocol that ensures loop free topology. Switches send BPDUs to discover loops. BPDUs helps elect the core of the network switch which is root bridge.
1st step – Selects a root bridge –
- By selecting the Bridge ID (lowest is better)
Each bridge has a unique ID & configurable priority #
Value between 0 & 61440 (default is 32768)
2.By selecting the MAC address (lowest is better)
The older the switch is, the lower its MAC address
Selects Root port – Each bridge determines primary port facing root. This is per the lowest path cost to the root bridge.
Root port: used to reach the root bridge
Selects Designated port – used to send and received packets on a specific segment
How? Port elects per lower path cost to the root bridge per segment.
Designated port: forwarding port, one per link
Block ports with loops – all non-root and non-designated ports are blocked. The switch with the highest MAC address will block its link.
able 3-2. Three Major 802.1d STP Process Steps
How STP finds the Best Path
1st step: Elect the Root Bridge
2nd step: Switches find lowest cost path to root
|Bandwidth||STP Cost Value|
3rd step: What if the cost is tie? Bridge ID (priority + MAC address)
4th step: What if Bridge ID is tie? It will look for the lower port. Example: fa0/0 rather than fa0/1
We determined the root bridge and compute the port roles. (root, designated or blocked). The bridge sends BPDU to exchange information about the Bridge ID and root path costs.
A bridge sends a BPDU frame using the unique MAC address of the port itself as a source address, and a destination address of the STP multicast address 01:80:C2:00:00:00.
There are three types of BPDUs:
- Configuration BPDU (CBPDU), used for Spanning Tree computation
- Topology Change Notification (TCN) BPDU, used to announce changes in the network topology
Informs switches of any (up/down) port changes.
- Topology Change Notification Acknowledgment (TCA)
BPDU’s are being sent every 2 seconds so that the switches can keep track of the network changes and to start and stop forwarding at ports.
STP switch port states
- Blocking – A port that blocks a switching loop.
- Listening – The switch processes BPDUs and awaits possible new information that would cause it to return to the blocking state.
- Learning – While the port does not yet forward frames (packets) it does learn source addresses from frames received and adds them to the filtering database (switching database)
- Forwarding – A port receiving and sending data, normal operation. This happens when you connect a host or a server to a switch.
Types of STP
PVST (Per VLAN Spanning Tree) – A Network switches where multiple VLANs coexist. Run 1 instance per VLAN.
Adds VLAN inside the BPDU header (priority + MAC address). PVST (Priority + VLAN + MAC Address).
Pros: 1 Root Bridge per VLAN & Load balancing
Cons: Cisco proprietary – only works in ISL