实验拓扑

STP实验 - 图1

图 1-1

注:如无特别说明,描述中的 R1 或 SW1 对应拓扑中设备名称末尾数字为 1 的设备,R2 或 SW2 对应拓扑中设备名称末尾数字为 2 的设备,以此类推


实验需求

  1. 开启所有设备,等待 STP 收敛后观察 STP 状态
  2. 使 SW4 成为根网桥
  3. 使闭塞端口出现在 SW2 上
  4. 把 SW1 上连接的 PC 的端口配置为边缘端口

实验解法

  1. 等待 STP 收敛后,查看 STP 运行状态,找出根网桥,闭塞端口
    步骤 1:根据 HCL 模拟器的运行机制,SW1 的 Mac 地址应该是最小的,会成为根网桥,在 SW1 上查看 STP 运行状态,确认 SW1 为根网桥 ```null [SW1]display stp

Bridge ID : 32768.7aef-e4ea-0100 Bridge times : Hello 2s MaxAge 20s FwdDelay 15s MaxHops 20 Root ID/ERPC : 32768.7aef-e4ea-0100, 0 RegRoot ID/IRPC : 32768.7aef-e4ea-0100, 0 RootPort ID : 0.0 BPDU-Protection : Disabled Bridge Config- Digest-Snooping : Disabled TC or TCN received : 7 Time since last TC : 0 days 0h:0m:40s

  1. <br />_步骤 2:根据 STP 计算机制,所有链路开销一致,闭塞端口应该会出现在 SW4 上。在 SW4 上查看端口状态,确认 SW4 的 g1/0/2 被闭塞_
  2. ```null
  3. [SW4]display stp brief
  4. MST ID Port Role STP State Protection
  5. 0 GigabitEthernet1/0/1 ROOT FORWARDING NONE
  6. 0 GigabitEthernet1/0/2 ALTE DISCARDING NONE
  1. 使 SW4 成为新的根网桥
    分析:要想使 SW4 成为根网桥,最好的办法就是让 SW4 的优先级成为全网最小。默认优先级都为 32768,只要把 SW4 的优先级改成比 32768 小就可以了
    步骤 1:修改 SW4 的优先级为 4096
    1. [SW4]stp priority 4096
    2. [SW4]%Mar 21 20:50:27:109 2018 SW4 STP/6/STP_DETECTED_TC: Instance 0


步骤 2:在 SW4 上查看 STP 运行状态,发现 SW4 已经成为新的根网桥

  1. [SW4]display stp
  2. Bridge ID : 4096.7af0-0e17-0400
  3. Bridge times : Hello 2s MaxAge 20s FwdDelay 15s MaxHops 20
  4. Root ID/ERPC : 4096.7af0-0e17-0400, 0
  5. RegRoot ID/IRPC : 4096.7af0-0e17-0400, 0
  6. RootPort ID : 0.0
  7. BPDU-Protection : Disabled
  8. Bridge Config-
  9. Digest-Snooping : Disabled
  10. TC or TCN received : 8
  11. Time since last TC : 0 days 0h:1m:30s
  1. 使闭塞端口出现在 SW2 上
    分析:SW4 成为了根网桥,按照 STP 计算机制,闭塞端口此时应该在 SW1 上。要使闭塞端口到 SW2 上,就需要让 SW2 到 SW1 的 cost 比 SW4 到 SW1 更大。H3C 交换机千兆口的 cost 默认是 20,我们可以把 SW2 的 g1/0/2 接口的 cost 改为 1000
    步骤 1:在 SW2 上进入 g1/0/2 接口的接口视图,修改 stp cost 为 1000
    1. [SW2]interface g1/0/2
    2. [SW2-GigabitEthernet1/0/2]stp cost 1000
    3. [SW2-GigabitEthernet1/0/2]%Mar 21 22:16:05:399 2018 SW2 STP/6/STP_NOTIFIED_TC: Instance 0


步骤 2:在 SW2 上查看 STP 接口状态,发现 SW2 的 g1/0/2 接口已经成为了新的闭塞端口

  1. [SW2]display stp brief
  2. MST ID Port Role STP State Protection
  3. 0 GigabitEthernet1/0/1 ROOT FORWARDING NONE
  4. 0 GigabitEthernet1/0/2 ALTE DISCARDING NONE
  1. 把 SW1 连接 PC 的所有接口配置为边缘接口
    1. [SW4]interface g1/0/3
    2. [SW4-GigabitEthernet1/0/3]stp edged-port
    3. Edge port should only be connected to terminal. It will cause temporary loops if port GigabitEthernet1/0/3 is connected to bridges. Please use it carefully.
  1. [SW4]interface g1/0/4
  2. [SW4-GigabitEthernet1/0/4]stp edged-port
  3. Edge port should only be connected to terminal. It will cause temporary loops if port GigabitEthernet1/0/4 is connected to bridges. Please use it carefully.


http://www.dengfm.com/15217173547010.html