Spanning Tree
لم يُترجم بعد؛ يُعرض باللغة الإنجليزية
Spare cables between switches keep a network running when one breaks, but they also form loops, and Ethernet frames have no TTL to stop them circling. Watch a broadcast storm happen, then watch Spanning Tree elect a root bridge, pick root and designated ports, block one port, and unblock it when a cable fails.
5 أسئلة سريعة
اختر إجابة لتعرف السبب. تُحفَظ نتيجتك مع تقدّمك.
01Why does a broadcast keep circling a loop of switches forever?
Each switch floods the broadcast to its other ports, and the Ethernet header has no TTL. IP packets carry a TTL that routers count down, but frames inside a LAN have nothing like it.
02Three switches all use priority 32768. Their MACs end in :01, :02 and :03. Which becomes the root bridge?
The lowest bridge ID wins. Priorities tie at 32768, so the lowest MAC address decides: :01.
03What is a switch's root port?
Every non-root switch picks one root port: the one with the lowest total path cost to the root. With 1 Gb/s links each hop costs 20 000.
04What does a blocked (alternate) port do?
A blocked port discards data frames, which cuts the loop, but it keeps receiving BPDUs so it can take over if the tree changes.
05The cable to SW3's root port fails. What happens with Rapid STP?
The alternate port was already the next-best path to the root, so RSTP promotes it straight away. Classic 802.1D needed 30 to 50 seconds to get there.
المسرد
- Loop
- A circle of links between switches. It gives a spare path, but frames can travel round it again and again.
- Broadcast storm
- Broadcasts circling a loop and multiplying until they fill the links and swamp every device.
- MAC flapping
- A switch's table entry for one MAC address jumping between ports, because copies of its frames arrive from both directions.
- Bridge ID
- A switch's spanning tree ID: a priority (32768 by default) followed by its MAC address. Lowest wins.
- Root bridge
- The switch with the lowest bridge ID. It is the centre of the tree; all its ports forward.
- Root port
- On every other switch, the one port with the cheapest path cost to the root bridge.
- Designated port
- On each link, the one end nearest the root. It forwards frames onto that link.
- BPDU
- Bridge Protocol Data Unit: the small message switches use to share bridge IDs and path costs, every 2 seconds by default.
الملاحظات والمصادر
- Switch and host MAC addresses (00:00:5e:00:53:xx) are RFC 7042 documentation values; ff:ff:ff:ff:ff:ff is the real broadcast address and 01:80:c2:00:00:00 the real address BPDUs are sent to. Host IPs are from 192.168.1.0/24 (RFC 1918).
- Many switches set the priority in steps of 4096 and add the VLAN number to it (IEEE 802.1t), so the default shows as 32769 on VLAN 1. The comparison works the same way.
- Path costs are the IEEE 802.1D-2004 recommended values (1 Gb/s = 20 000, 100 Mb/s = 200 000). The older 802.1D-1998 table used 4 and 19.
- STP was IEEE 802.1D; Rapid STP (802.1w) replaced it in 802.1D-2004, and both now live in IEEE 802.1Q. MSTP (802.1s) runs one tree per group of VLANs.
- Classic STP defaults: hello 2 s, max age 20 s, forward delay 15 s. A port listens then learns for 2 × 15 s before it forwards.
- Real frames circle a loop millions of times a second; the figure slows everything down so you can watch.
- IEEE 802.1Q: Bridges and Bridged Networks (spanning tree, RSTP, MSTP)
- IEEE 802.1D-2004: MAC Bridges (STP and RSTP)
- Perlman, An algorithm for distributed computation of a spanning tree in an extended LAN (SIGCOMM 1985)
- Cisco: Understand Rapid Spanning Tree Protocol (802.1w)
- RFC 7042: IANA considerations for IEEE 802 parameters (documentation MACs)
- RFC 1918: Address allocation for private internets
اختبار يتاح بعد الخطوة الأخيرة.