STP (Spanning Tree Protocol)
Consequences without STP
- Broadcast storm
- Overwritten MAC tables make them unstable
- Multiple same frames will be received by the device
Election of root bridge
- Root bridge is determined by the Bridge ID
- All the switches send Bridge ID information (BPDU Bridge Protocol Data Unit) to the other ones. The switches will compare the Bridge ID that received with their own Bridge ID.
- The switch which has lowest Bridge ID is elected to be the root bridge
- Bridge ID = Bridge Priority + Extended System ID + MAC address
Bridge ID |
4 bits |
8 bits |
48 bits |
|
Bridge Priority |
Extended System ID |
MAC address |
- Default priority value of cisco switches is 32768, the range is 0 to 61440 in increments of 4096
- The extended system ID is a decimal value that added to the bridge priority to identify the vlan for this BPDU. (Different vlans may have different root bridge)
Root port determination
- The port has the lower cost to the root bridge
|
10 Mbps |
100 Mbps |
1 Gbps |
10 Gbps |
Path Cost |
100 |
19 |
4 |
2 |
if ports have same path cost to the root bridge, the port connects to the neighbor switch who has the lower Bridge ID is determined to be root port
Elect designated ports
- All ports on the root bridge are designated ports
- If one end of the a segment is root port, then the other end is a designated port.
- The port has the lower path cost to the root bridge is elected to be designated port in a segment which neither of ports are root ports.
Elect alternate (Blocked) port
- if the port is not a root or designated port, it becomes a alternate (blocked) port.
- it will not forward the Ethernet frame
STP timers
- Hello Timer : default 2 seconds, can be modified between 1 and 10 seconds.
- Forward delay timer : Forward delay is the time that is spent in the listening and learning state. Default is 15 seconds. Can be modified between 4 and 30 seconds.
- Max Age timer : Max age is the maximum time that a switch waits before attempting to change the STP topology. Default is 20 seconds, can be modified between 6 and 40 seconds.
Port states
- Blocking : Max Age = 20 seconds
- Listening : Forward delay = 15 seconds
- Learning : Forward delay = 15 seconds
- Forwarding
RSTP
Port state
STP |
RSTP |
Disabled |
Discarding |
Blocking |
Listening |
Learning |
Learning |
Forwarding |
Forwarding |
STP |
RSTP |
Root |
Root |
Designated |
Designated |
Blocked |
Backup |
Alternate |
Portfast
- when a port is configured with portfast, it will transit from blocking to forwarding immediately bypassing the listening and learning state.
- Only for the ports that connect to the end devices.