# 9 Spanning Tree Protocol Concepts
###### tags: `CCNA`
### The Need for Spanning Tree
STP/RSTP prevents three common problems in Ethernet LANs. All three problems occur as a
side effect of one fact: without STP/RSTP, some Ethernet frames would loop around the network
for a long time.

**Lopping會造成的3個問題**

### What Spanning Tree Does

### How Spanning Tree Works
STP/RSTP uses three criteria to choose whether to put an interface in forwarding state:
- STP/RSTP elects a root switch. **STP puts all working interfaces on the root switch in forwarding state.**
- Each nonroot switch considers one of its ports to have the least administrative cost between itself and the root switch. The cost is called that switch’s root cost. STP/RSTP places its port that is part of the least root cost path, called that switch’s **root port (RP), in forwarding state.**
- Many switches can attach to the same Ethernet segment, but due to the fact that links connect two devices, a link would have at most two switches. With two switches on a link, the switch with the lowest root cost, as compared with the other switches attached to the same link, is placed in forwarding state. That switch is the designated switch, and that switch’s interface, attached to that segment, is called the designated port (DP).
### The STP Bridge ID and Hello BPDU
The STP/RSTP **bridge ID (BID) is an 8-byte value unique to each switch.**
**The bridge ID consists of a 2-byte priority field and a 6-byte system ID**, with the system ID being based on a universal (burned-in) MAC address in each switch. Using a burned-in MAC address ensures that each switch’s bridge ID will be unique.

**Electing the Root Switch**

- The lowest priority
- If that ties, the lowest switch MAC address

**STP Timers**

STP sysytme id extension
