Sub topic 2
Port Roles in the Spanning Tree
Assume you understand Ethernet MAC learning, VLANs, trunks, and basic switch CLI output. In classic Spanning Tree Protocol (STP), every port receives a role and a state. These roles create one loop-free forwarding tree while redundant links remain available.
Port roles and selection
The root bridge is the switch with the lowest bridge ID. Every other switch selects one root port: its best path toward the root bridge.
On each network segment, one designated port provides the best path away from the root. A port that loses this comparison becomes non-forwarding. Common roles are:
| Role | Purpose |
|---|---|
| Root port | Best path from a non-root switch to the root bridge |
| Designated port | Best path from a segment toward the root |
| Alternate port | Backup path to the root, usually in RSTP |
| Backup port | Backup for another port on the same shared segment |
Switches compare BPDUs in this order:
- Lowest root bridge ID.
- Lowest root path cost.
- Lowest sender bridge ID.
- Lowest sender port ID.
- Lowest local port ID, when needed.
The root bridge has no root port. Its active ports are normally designated ports. A deliberately placed root bridge gives predictable traffic paths.
Port states and convergence
Classic 802.1D STP uses these states:
- Blocking: receives BPDUs but does not learn or forward data frames.
- Listening: evaluates BPDUs but does not learn MAC addresses.
- Learning: learns source MAC addresses but does not forward data frames.
- Forwarding: learns MAC addresses and forwards frames.
- Disabled: does not participate.
A typical transition spends one forward-delay interval listening and another learning. The hello timer controls BPDU transmission. Max age controls how long a switch trusts an old BPDU. These timers make classic STP predictable but slow, often taking about 30 to 50 seconds after a failure.
> callout warning > Do not treat a blocked port as failed. It is intentionally preventing a Layer 2 loop and may become forwarding after a path failure.
Topology changes and verification
When the active topology changes, switches may flush learned MAC entries early. They then flood more unknown-unicast traffic while relearning locations. Frequent changes can therefore cause bursts of flooding and instability.
Use status commands to compare the elected root, port roles, costs, and states:
show spanning-tree vlan 10
show spanning-tree interface GigabitEthernet0/1 detail
show spanning-tree inconsistentportsLook for the root ID, each port's role and state, root path cost, and recent topology-change information. An unexpected root or forwarding port often indicates a priority, cabling, or guard-feature problem.
Exercise
A switch has two paths to the root. Both received BPDUs advertise the same root ID. What does the switch compare next?
Show answer
It compares the root path cost, then the sender bridge ID and sender port ID if costs tie.