Ethernet Switching Fundamentals (VLAN, STP/RSTP, Link Aggregation)
VLANs and links
A VLAN is a broadcast domain; VLAN 1 exists by default and every port starts in it. Access ports carry one VLAN with untagged frames, trunk ports carry many VLANs with 802.1Q tags (4 bytes, 12-bit VLAN ID → 4094 usable VLANs). Huawei also offers hybrid ports, which can tag or untag per VLAN. The native VLAN (default VLAN 1) travels untagged on a trunk, so both ends must agree or traffic is misclassified - a favourite exam trap, as is forgetting that a trunk needs port trunk allow-pass vlan configuration for each VLAN.
Spanning Tree
STP (802.1D) prevents loops by electing one root bridge (lowest bridge ID = priority + MAC; priority default 32768, adjustable in steps of 4096), then giving every non-root switch one root port and every segment one designated port; the rest block. 802.1D states are blocking, listening, learning, forwarding (plus disabled). RSTP (802.1w) converges in seconds using proposal/agreement, edge ports and the alternate/backup port roles, with only discarding, learning and forwarding states. MSTP (802.1s) maps multiple VLANs to instances. Remember Huawei's default path-cost standard is 802.1t (1 Gbit/s = 20000), not the older 802.1D table.
Link aggregation
An Eth-Trunk bundles physical links for bandwidth and redundancy. Members must match in rate, duplex and VLAN configuration. Manual mode uses no negotiation; LACP mode negotiates (static or dynamic), selecting active links by system priority and port priority up to the max-active-linknumber.
Rule of thumb
Root bridge = lowest priority, then lowest MAC; root port = lowest cumulative path cost to the root, then lowest upstream bridge ID, then lowest upstream port ID.