STP生成树实验

实验拓扑

实验需求

  1. 所有设备都运行STP
  2. 改变阻塞端口

实验步骤

1.所有设备都运行STP ,等到收敛完毕,观察状态

[SW1]stp mode stp 
[SW2]stp mode stp
[SW3]stp mode stp

2,在SW1查看STP 状态,发现SW1成为根桥

分析:生成树收敛选举原则是,比较设备根桥ID、根路径开销(cost)、指定桥ID(转发桥ID)、端口ID,一旦比较出大小,就会确定角色,不会继续比较后续参数
  
  根桥ID =交换机优先级(32768)+MAC地址
  根路径开销 =非根交换机到达根桥所经过的所有路径开销之和
  指定桥ID =交换机优先级(32768)+MAC地址
  端口ID =端口优先级(128)+端口号

[Huawei]dis stp
-------[CIST Global Info][Mode STP]-------
CIST Bridge         :32768.4c1f-cc40-5e35
Config Times        :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Active Times        :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC      :32768.4c1f-cc40-5e35 / 0
CIST RegRoot/IRPC   :32768.4c1f-cc40-5e35 / 0
CIST RootPortId     :0.0
BPDU-Protection     :Disabled
TC or TCN received  :13
TC count per hello  :0
STP Converge Mode   :Normal 
Time since last TC  :0 days 1h:4m:16s
Number of TC        :8
Last TC occurred    :Ethernet0/0/1

3. 查看各设备的端口角色和状态

在SW3上查看,发现E0/0/2接口为阻塞状态。

[SW1]dis stp brief 
 MSTID  Port                        Role  STP State     Protection
   0    Ethernet0/0/1               DESI  FORWARDING      NONE
   0    Ethernet0/0/2               DESI  FORWARDING      NONE
[SW2]dis stp brief 
 MSTID  Port                        Role  STP State     Protection
   0    Ethernet0/0/1               DESI  FORWARDING      NONE
   0    Ethernet0/0/2               ROOT  FORWARDING      NONE
[SW3]dis stp brief 
 MSTID  Port                        Role  STP State     Protection
   0    Ethernet0/0/1               ROOT  FORWARDING      NONE
   0    Ethernet0/0/2               ALTE  DISCARDING      NONE

4.在SW3上改变开销,使使阻塞端口切换为e 0/0/1

观察发现,E0/0/1端口变为了预备端口

[Huawei-Ethernet0/0/1]stp cost 400001

[Huawei-Ethernet0/0/1]dis stp brief 
 MSTID  Port                        Role  STP State     Protection
   0    Ethernet0/0/1               ALTE  DISCARDING      NONE
   0    Ethernet0/0/2               ROOT  FORWARDING      NONE

分析:要使阻塞端口改变为 E0/0/1,我们需要把SW3 到SW1的开销比 SW3经过SW2到达LW1的开销更大,华为默认端口开销为200000 ,我们把连接SW1 的E0/0/1接口开销改成400001就行

posted @ 2019-07-18 13:34  我是C  阅读(1906)  评论(0编辑  收藏  举报