Study guide
STP Concepts and Election
Huawei Certified ICT Associate - Datacom HCIA-Datacom H12-811 V1.0
Track your progress as you read
Finished sections get a check mark.
1 Introduction
About HCIA-Datacom H12-811 V1.0 Study Strategies and Exam Logistics
2 Chapter 1: Network Models and Ethernet Fundamentals
OSI and TCP/IP Models Ethernet Technology and MAC Addressing Data Forwarding and Campus Network Lifecycle
3 Chapter 2: IPv4 Addressing and Transport Protocols
IPv4 Addressing and Subnetting ARP and ICMP TCP and UDP Principles Common Ports and Application Protocols
4 Chapter 3: Huawei VRP Basics and Device Management
VRP CLI Views and Core Commands Configuration Save, Reset, and File System SSH, Telnet, and Console Access Display Commands and Basic Troubleshooting
5 Chapter 4: Ethernet Switching and VLANs
Switch Forwarding and MAC Address Tables VLAN Concepts and Segmentation Access, Trunk, and Hybrid Link Types VLANIF and Inter-VLAN Routing
6 Chapter 5: STP, RSTP/MSTP, and Link Aggregation
STP Concepts and Election RSTP and MSTP Eth-Trunk Static and LACP Stacking Basics for Campus Switches
7 Chapter 6: IP Routing Fundamentals
RIB, FIB, and Forwarding Decisions Static and Default Routes on VRP Route Preference and Longest Match Floating Static Routes and Blackhole Routes
8 Chapter 7: OSPF Fundamentals
OSPF Areas and Router Types Neighbor States and Adjacency LSA Types and LSDB DR/BDR Election and VRP OSPF Configuration
9 Chapter 8: ACLs and AAA
Basic and Advanced ACLs traffic-filter Application and Matching Order AAA with Local, RADIUS, and HWTACACS
10 Chapter 9: DHCP, NAT, and Network Services
DHCP Server, Relay, and Snooping NAT, Easy IP, and NAT Server FTP, TFTP, DNS, NTP, HTTP Basics
11 Chapter 10: WLAN Basics
WLAN Architecture: AC, AP, and Fit Mode CAPWAP Tunnels and Forwarding Modes WPA2, WPA3, and WLAN Security Basics Basic WLAN Configuration Concepts
12 Chapter 11: WAN Basics
WAN Concepts and Encapsulation PPP Authentication: PAP and CHAP PPPoE Basics and Client Configuration
13 Chapter 12: IPv6 Fundamentals
IPv6 Address Types and Format Neighbor Discovery and ICMPv6 Stateful and Stateless DHCPv6 IPv6 Static Routes on VRP
14 Chapter 13: SDN and NFV Fundamentals
SDN and NFV Fundamentals
15 Chapter 14: Network Management and O&M
Network Management, O&M, and Automation Basics
STP Concepts and Election
Key Takeaways Explain This Topic AI
Layer 2 Ethernet has no TTL; redundant switch links without STP create broadcast storms, MAC flapping, and network collapse.
STP elects one root bridge per spanning tree using the lowest Bridge ID (priority + MAC); default priority is 32768 and configurable steps are multiples of 4096.
Each non-root switch elects one root port (lowest path cost to the root); each segment elects one designated port; remaining ports become alternate/blocked to break loops.
Classic 802.1D port states include Blocking, Listening, Learning, and Forwarding; timer-based convergence can take tens of seconds after a topology change.
On Huawei VRP, control root placement with stp priority or stp root primary/secondary and verify with display stp brief and display stp.
Last updated: July 2026
STP Concepts and Election
Quick Answer: Spanning Tree Protocol (STP) prevents Layer 2 loops by electing one root bridge, choosing one best path toward that root on each switch, and blocking redundant links. Bridge ID = priority (default 32768, steps of 4096) + MAC address; lowest wins. Port roles are root, designated, and alternate (blocked). Classic states progress Blocking → Listening → Learning → Forwarding.
Campus switches almost always have redundant uplinks for high availability. Without a loop-prevention protocol, that redundancy becomes a liability: broadcast and unknown unicast frames circulate forever, MAC tables thrash, and the VLAN becomes unusable. STP (and its faster descendants RSTP/MSTP covered next) is the standard solution HCIA-Datacom expects you to understand at both conceptual and basic configuration depth.
Why Layer 2 loops are catastrophic
IP packets have a TTL field that decrements at each hop and is discarded at zero. Ethernet frames do not . If Switch A floods a broadcast to Switch B, and Switch B floods it back to Switch A over a second link in the same VLAN, the frame multiplies and never dies. Symptoms you must associate with a Layer 2 loop include:
Broadcast storm: utilization on links and CPUs climbs toward 100%; even unicast applications fail because the fabric is busy flooding.
MAC address flapping: the same source MAC is learned on alternating ports as the frame reappears, so the switch keeps rewriting its MAC table.
Intermittent reachability: some frames take path A, some take path B; sessions reset and ARP becomes unstable.
Redundant physical topology is good. Uncontrolled active redundancy at Layer 2 is not. STP’s job is to leave a logical tree : enough links remain forwarding so every switch is still reachable, but every loop is broken by blocking at least one port per loop.
STP goals and BPDUs
STP builds a loop-free topology by exchanging Bridge Protocol Data Units (BPDUs) . Classic STP uses multicast destination 01-80-C2-00-00-00 . Each BPDU carries the sender’s view of:
- Root Bridge ID
- Path cost to that root
- Sender Bridge ID
- Port ID (priority + port number)
- Timers (Hello, Max Age, Forward Delay)
Switches compare these values using a strict hierarchy so every device converges on the same root and the same set of forwarding links.
Root bridge election
Every STP instance elects exactly one root bridge . The winner is the switch with the lowest Bridge ID (BID) :
- BID component Default / range (exam focus) Notes
- Bridge priority Default 32768 Configurable in multiples of 4096 (0, 4096, 8192, …, 61440)
- System MAC Hardware base MAC Tie-breaker when priorities are equal
Exam trap: if two candidates have the same priority, the switch with the lower MAC address becomes root. Operators almost never leave root election to the lowest MAC by accident—designated core or aggregation switches should be forced to win with a lower priority (for example 0 or 4096).
- On Huawei VRP you will see patterns such as: [SW] stp enable
- [SW] stp mode stp
- [SW] stp priority 4096
- or the convenient role shortcuts: [Core] stp root primary
- [Agg] stp root secondary
stp root primary sets a low priority so the device is preferred as root; secondary sets a value suitable as backup root if the primary fails. Always verify with display stp brief or display stp after changes.
Path cost and root port election
Once the root is known, every non-root switch elects exactly one root port (RP) —the port with the lowest cumulative path cost to the root. Path cost is based on link bandwidth (higher speed = lower cost). If costs tie, STP compares:
- Lowest upstream (sender) Bridge ID
- Lowest port priority / Port ID on the neighbor
- Local port ID as final tie-breaker
The root port is always in a forwarding state once convergence completes (except during transitional states).
Typical path-cost intuition (exam level)
Exact default tables vary by standard revision and vendor defaults, but the relationship is what HCIA tests: 10 Gbit/s costs less than 1 Gbit/s, which costs less than 100 Mbit/s . Preferring a GE uplink over FE is automatic when costs are left at defaults. Engineers can override cost with interface-level configuration when design requires a non-default path, but understand that arbitrary cost changes affect the entire tree.
Designated ports and alternate (blocked) ports
For every network segment (link or shared LAN), STP elects one designated port (DP) —the port that advertises the best path to the root on that segment. On a point-to-point switch-to-switch link, one side becomes DP and the other becomes either RP (if that switch uses the link toward the root) or an alternate/blocked port.
- Port role Who has it Forwarding user traffic? Purpose
- Root port Non-root switches (one each) Yes (after convergence) Best path toward the root
- Designated port One per segment Yes Forwards toward leaves / other switches
- Alternate (non-designated) Losers on redundant segments No (blocking) Backup path if RP or DP fails
- Disabled Admin down / STP disabled contexts No Out of service
All switches on a shared segment compare BID and root path cost; the switch with the best claim places its DP in forwarding. Other ports facing that segment block, which is exactly how the loop is broken.
Classic 802.1D port states
HCIA still expects the classic state machine even though modern campus gear usually runs RSTP/MSTP:
- State Learns MACs? Forwards frames? Role in convergence
- Blocking No No Receives BPDUs only; breaks loops
- Listening No No Transitional; prepares to participate after Max Age / topology change
- Learning Yes No Builds MAC table before forwarding to reduce flooding
- Forwarding Yes Yes Normal data plane operation
- Disabled No No Port administratively down or STP not running on it
Timers that drive classic convergence include Hello (default 2 s), Max Age (default 20 s), and Forward Delay (default 15 s). A topology change can force ports through Listening and Learning for roughly 2 × Forward Delay , so full reconvergence on the order of 30–50 seconds is normal for pure 802.1D. That delay is a major reason vendors adopted RSTP.
Worked election example
Imagine three switches in a triangle, all links GE, same default costs:
- SW1 priority 4096, MAC ends in …0011
- SW2 priority 32768, MAC ends in …00AA
- SW3 priority 32768, MAC ends in …00BB
Root: SW1 wins immediately because 4096 is lower than 32768.
Root ports: SW2 and SW3 each choose their direct link toward SW1 as RP (one hop, lowest cost).
Designated ports: On the SW1–SW2 and SW1–SW3 links, SW1’s ports are designated. On the SW2–SW3 link, both switches compare path cost to root (equal: both already have cost of the direct GE to SW1). They then compare Bridge IDs; SW2’s MAC …00AA is lower than SW3’s …00BB, so SW2’s port on the SW2–SW3 link becomes designated and SW3’s port blocks . The logical topology is a tree rooted at SW1 with the SW2–SW3 link as a standby path.
If the SW1–SW2 link fails, SW2 loses its root port, ages out old information, and (after classic timers or faster RSTP signaling) unblocks toward SW3, using SW3 as the new path to the root. Understanding this sequence—root first, then RPs, then DPs, then blockers—is the core exam skill.
- Huawei verification and design notes
- Useful VRP checks: [SW] display stp brief
- [SW] display stp
- [SW] display stp interface GigabitEthernet0/0/1
Confirm which device is root, which local ports are ROOT / DESI / ALTE, and whether the priority you configured took effect. Design guidelines for HCIA-level campus networks:
Place the root on the core or distribution layer, never on a random access switch that happens to have a low MAC.
Configure a secondary root so failover is predictable.
Keep access-layer downlinks from becoming transit paths for other switches unless the design intentionally uses them.
Remember that STP operates per VLAN or per instance depending on mode (PVST-style thinking vs MSTP instances—covered in the next section). Classic single STP still builds one tree for the whole bridge , which can leave some VLANs on suboptimal links; that limitation motivates MSTP.
Exam checklist
State why Ethernet loops cause storms (no TTL) and name the three classic symptoms.
Compute root from priority and MAC; know the 4096 priority step and default 32768 .
Map roles: root port, designated port, alternate/blocked.
Order classic states and explain why Learning exists before Forwarding.
On Huawei, associate stp enable , stp priority , stp root primary/secondary , and display stp with root control and verification.
Master election mechanics here; RSTP and MSTP reuse the same Bridge ID and cost comparisons while improving speed and VLAN load sharing.