The STP loop guard feature enhances protection against Layer 2 forwarding loops in network topologies. A forwarding loop can happen when a blocking port within a redundant topology mistakenly transitions to the forwarding state. This situation typically occurs when any port in the topology" whether it is the blocking port or not—stops receiving STP BPDUs. STP's functionality depends on the continuous exchange of BPDUs; designated ports are responsible for transmitting BPDUs, while non-designated ports are set to receive them. This ongoing exchange is critical to maintaining the loop-free nature of the network.
STP loop guard 功能可強化網路拓樸中對抗第 2 層轉送迴圈的防護能力。當備援拓樸中處於阻斷狀態的連接埠不小心轉換為轉送狀態時,就可能發生轉送迴圈。這種情況通常發生在拓樸中任何連接埠,不論是不是阻斷連接埠,停止接收 STP BPDU 時。STP 的運作依賴 BPDU 持續不斷的交換:指定埠負責傳送 BPDU,而非指定埠則負責接收。這種持續的交換對於維持網路無迴圈的特性至關重要。
When one of the ports in a physically redundant topology no longer receives BPDUs, STP assumes that the topology is loop free. Eventually, the blocking port from the alternate or backup path becomes designated and moves to a forwarding state. This situation creates a loop.
當實體備援拓樸中的某個連接埠不再收到 BPDU 時,STP 會認定拓樸已經沒有迴圈。最終,替代或備援路徑上的阻斷連接埠會變成指定埠,並轉為轉送狀態,這種情況就會形成迴圈。
The STP loop guard feature makes additional checks. If BPDUs are not received on a non-designated port, and loop guard is enabled, that port is moved into the STP loop-inconsistent blocking state, instead of the listening / learning / forwarding state. Without the loop guard feature, the port would assume the designated port role. The port moves to the STP forwarding state and creates a loop.
STP loop guard 功能會執行額外的檢查。若某個非指定埠未收到 BPDU,且已啟用 loop guard,該連接埠就會被轉為 STP 迴圈不一致(loop-inconsistent)阻斷狀態,而不是進入聆聽/學習/轉送狀態。若沒有 loop guard 功能,該連接埠就會擔任指定埠角色,轉為 STP 轉送狀態並形成迴圈。
When the loop guard blocks an inconsistent port, this message is logged:
當 loop guard 阻斷一個不一致的連接埠時,系統會記錄以下訊息:
%SPANTREE-2-LOOPGUARD_BLOCK: Loop guard blocking port GigabitEthernet0/24 on VLAN0020.In the example Switch A functions as the root switch. Due to a unidirectional link failure between Switch B and Switch C, Switch C fails to receive BPDUs from Switch B.
在此範例中,交換器 A 作為根交換器。由於交換器 B 與交換器 C 之間發生單向鏈路故障,交換器 C 無法從交換器 B 收到 BPDU。
Without STP loop guard, the STP blocking port on Switch C advances to the STP listening state upon expiration of the max_age timer. Subsequently, it progresses to the forwarding state after twice the duration of the forward_delay time. This sequence of transitions can result in the formation of a loop.
若未啟用 STP loop guard,交換器 C 上處於阻斷狀態的 STP 連接埠會在 max_age 計時器逾時後進入 STP 聆聽狀態,接著在經過兩倍 forward_delay 時間後進入轉送狀態。這一連串的轉換可能導致迴圈形成。
When loop guard is enabled, the blocking port on Switch C shifts to the STP loop-inconsistent state as the max_age timer expires. A port in this loop-inconsistent state does not transmit user traffic, thereby preventing the creation of a loop. The loop-inconsistent state functions similarly to the blocking state.
啟用 loop guard 後,交換器 C 上的阻斷連接埠會在 max_age 計時器逾時時轉為 STP 迴圈不一致狀態。處於此迴圈不一致狀態的連接埠不會傳送使用者流量,因而防止迴圈形成。迴圈不一致狀態的運作方式與阻斷狀態類似。
Loop guard should be activated on non-designated ports, specifically on root and alternate ports, across all active topologies. Since loop guard does not operate on a per-VLAN basis, the same trunk port may be designated for one VLAN while being non-designated for another.
Loop guard 應該在所有活動拓樸中的非指定埠上啟用,特別是根埠與替代埠。由於 loop guard 並非以每個 VLAN 為單位運作,同一條中繼埠可能對某個 VLAN 而言是指定埠,對另一個 VLAN 而言卻是非指定埠。

