3.2 STP Costs, Port Roles, States and BPDUs
Key Takeaways
Long path-cost values distinguish modern link speeds; a 10-Gbps link normally has cost 2000.
RSTP root/designated/alternate/backup roles are different from discarding/learning/forwarding states.
BPDUs convey root and path information plus proposal/agreement and topology-change flags; they do not negotiate a native VLAN.
Path Cost Calculation: 802.1D vs. 802.1t
Each interface in the spanning tree topology is assigned a path cost representing link bandwidth. As BPDUs travel away from the Root Bridge, each non-root switch adds the receiving interface's ingress cost to the accumulated root path cost.
Legacy IEEE 802.1D used a 16-bit path cost value. This standard quickly became obsolete with the advent of Gigabit and 10-Gigabit Ethernet because 1 Gbps links defaulted to a cost of 4 and 10 Gbps links defaulted to 2 or 1, leaving no dynamic range for 40 Gbps or 100 Gbps speeds.
To solve this, IEEE published 802.1t, establishing a 32-bit path cost metric. Junos OS utilizes 802.1t 32-bit path costs by default across all EX and QFX series switches:
| Interface Speed | 802.1D Cost (16-bit legacy) | 802.1t Cost (32-bit Junos Default) |
|---|---|---|
| 10 Mbps | 100 | 2,000,000 |
| 100 Mbps (Fast Ethernet) | 19 | 200,000 |
1 Gbps (Gigabit Ethernet - ge) | 4 | 20,000 |
10 Gbps (10-Gigabit Ethernet - xe) | 2 | 2,000 |
40 Gbps (40-Gigabit Ethernet - et) | 1 | 500 |
100 Gbps (100-Gigabit Ethernet - et) | 1 | 200 |
Engineers can manually override the interface cost in Junos to steer traffic along preferred physical paths:
[edit protocols rstp]
user@EX4300# set interface ge-0/0/0.0 cost 1000
Spanning Tree Port Roles: 802.1D vs. 802.1w
In 802.1D, interfaces are classified into three primary roles: Root Port, Designated Port, or Non-Designated (Blocking) Port. RSTP (802.1w) refines these definitions into four distinct, deterministic roles:
- Root Port (RP): Exactly one port on each non-root switch that provides the lowest accumulated path cost back to the Root Bridge. Root Ports forward user data traffic and receive BPDUs.
- Designated Port (DP): Exactly one port per physical link/segment that advertises the lowest path cost to the Root Bridge for that segment. The root’s ports are normally designated; a redundant connection to the same shared segment can instead have a backup role. Designated Ports transmit BPDUs down into the network and forward data frames.
- Alternate Port (AP): An interface that receives superior BPDUs from another switch, representing an alternate, redundant path to the Root Bridge. The Alternate Port remains in a non-forwarding state but immediately transitions to a Root Port if the primary Root Port fails.
- Backup Port (BP): An interface that receives superior BPDUs transmitted by the same switch (typically seen only when redundant ports connect to an unmanaged hub or shared collision domain). The Backup Port acts as a standby backup for the switch's own Designated Port.
Port States: 802.1D vs. RSTP
Legacy 802.1D defines five distinct port operational states. Because three of these states (Disabled, Blocking, Listening) do not forward user frames or populate the MAC address table, RSTP unifies them into a single operational state called Discarding.
| 802.1D Legacy State | RSTP (802.1w) State | Forwards Data Frames? | Learns MAC Addresses? | Processes BPDUs? |
|---|---|---|---|---|
| Disabled | Discarding | No | No | No |
| Blocking | Discarding | No | No | Yes |
| Listening | Discarding | No | No | Yes |
| Learning | Learning | No | Yes | Yes |
| Forwarding | Forwarding | Yes | Yes | Yes |
- Discarding: The port prevents Layer 2 loops by dropping all received data frames and refusing to transmit traffic. It listens to and evaluates incoming BPDUs to maintain topology awareness.
- Learning: The port prepares to forward traffic by inspecting the source MAC addresses of passing frames to build the local forwarding database, but it does not yet forward user data frames.
- Forwarding: The port fully participates in data transmission, actively learning MAC addresses and forwarding unicast, multicast, and broadcast frames.
BPDU Structure and Encodings
Switches exchange spanning tree control information inside Bridge Protocol Data Units (BPDUs), encapsulated directly in Ethernet frames with destination MAC 01:80:C2:00:00:00:
- 802.1D BPDUs: Legacy STP uses two separate frame formats: the Configuration BPDU (Type
0x00), which originates solely from the Root Bridge and is relayed downstream by designated bridges, and the Topology Change Notification (TCN) BPDU (Type0x80), which non-root switches transmit upstream toward the Root Bridge when link states change. - RSTP BPDUs: RSTP uses a single unified RST BPDU (Protocol Version 2, BPDU Type
0x02). Every switch generates its own RST BPDUs every Hello interval (default 2 seconds), regardless of whether it receives a BPDU from the Root Bridge.
Furthermore, while 802.1D uses only 2 of the 8 bits in the BPDU Flag Byte (Bit 0 for Topology Change and Bit 7 for Topology Change Acknowledgment), RSTP utilizes all 8 bits of the Flag Byte to execute its rapid convergence protocol:
+--------+----------+-----------+-----------+----------+------------+-----------+--------+
| Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 |
| TCA |Agreement |Forwarding | Learning | Port Role (2 bits) | Proposal | TC |
+--------+----------+-----------+-----------+----------+------------+-----------+--------+
The Port Role bits encode four values: 00 (Unknown), 01 (Alternate/Backup), 10 (Root), and 11 (Designated). The Proposal and Agreement bits drive RSTP's sub-second handshake synchronization.
In Rapid Spanning Tree Protocol (IEEE 802.1w), what port role is assigned to a port that receives superior BPDUs from another bridge on an alternate path to the Root Bridge, and what operational state does this port maintain?
Backup Port in the Blocking state
Alternate Port in the Discarding state
Root Port in the Learning state
Designated Port in the Discarding state
A network engineer connects a Juniper EX switch to an aggregation switch using a 10-Gigabit Ethernet (xe-0/0/0) interface under default Junos RSTP settings. According to the IEEE 802.1t path cost standard used by Junos, what is the default STP cost assigned to this interface?
20,000
19
2,000
200
Sections you finish are checked off in the contents.