zoukankan      html  css  js  c++  java
  • Huawei-R&S-网络工程师实验笔记20190607-STP生成树协议(基本配置、桥优先级、根桥选举、根端口、路径开销、边缘端口)

    》Huawei-R&S-网络工程师实验笔记20190607-STP生成树协议(基本配置、桥优先级、根桥选举、根端口、路径开销、边缘端口)

    》》实验开始,先上拓扑图参考:

    <Huawei>system-view 
    Enter system view, return user view with Ctrl+Z.
    [Huawei]sysname SWA
    [SWA]stp ?         //查询STP协议下配置命令
      bpdu-filter           STP BPDU filter
      bpdu-protection       Specify BPDU protection function
      bridge-diameter       Specify bridge diameter
      converge              Specify STP converge mode
      disable               Disable Spanning Tree Protocol (STP)   //禁用STP
      edged-port            Specify edge port
      enable                Enable Spanning Tree Protocol (STP)    //启用STP
      instance              Spanning tree instance
      max-hops              Specify max hops
      mcheck                Specify mcheck
      mode                  Specify state machine mode
      pathcost-standard     Specify STP port path cost standard
      priority              Specify bridge priority      //指定桥优先级
      process               The MSTP process
      region-configuration  Enter MSTP region view
      root                  Specify root switch
      snooping              STP snooping
      tc-protection         Enable the TC-BPDU Protection function
      timer                 Specify timer configuration
      timer-factor          Specify aged out time factor
    
    [SWA]stp disable          //关闭STP
    Warning: The global STP state will be changed. Continue? [Y/N]y
    Info: This operation may take a few seconds. Please wait for a moment...done.
    [SWA]
    Jun  7 2019 22:47:46-08:00 SWA DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
    .191.3.1 configurations have been changed. The current change number is 5, the c
    hange loop count is 0, and the maximum number of records is 4095.
    
    [SWA]display stp         //查看STP协议状态
     Protocol Status       :Disabled    //STP协议已经被关闭       
     Protocol Standard     :IEEE 802.1s             
     Version               :3             
     CIST Bridge Priority  :32768    //桥ID的默认优先级为32768             
     MAC address           :4c1f-cca8-6f8e             
     Max age(s)            :20     //最大老化时长为20秒             
     Forward delay(s)      :15     //转发延时为15秒         
     Hello time(s)         :2    //问候时长为2秒        
     Max hops              :20 
    [SWA]
    [SWA]stp enable          //开启STP
    Warning: The global STP state will be changed. Continue? [Y/N]y
    Info: This operation may take a few seconds. Please wait for a moment...done.
    [SWA]
    Jun  7 2019 22:49:06-08:00 SWA DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
    .191.3.1 configurations have been changed. The current change number is 6, the c
    hange loop count is 0, and the maximum number of records is 4095.
    [SWA]
    [SWA]display stp         //查看STP协议状态
    -------[CIST Global Info][Mode MSTP]-------     //默认配置是MSTP
    CIST Bridge         :32768.4c1f-cca8-6f8e
    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-cc27-5e6e / 20000
    CIST RegRoot/IRPC   :32768.4c1f-cca8-6f8e / 0
    CIST RootPortId     :128.25
    BPDU-Protection     :Disabled
    TC or TCN received  :10
    TC count per hello  :0
    STP Converge Mode   :Normal 
    Time since last TC  :0 days 0h:24m:6s
    Number of TC        :2
    Last TC occurred    :GigabitEthernet0/0/3
    ----   -- more --    ----
    [SWA]
    [SWA]stp mode ?         //查询修改生成树模式的配置命令
      mstp  Multiple Spanning Tree Protocol (MSTP) mode
      rstp  Rapid Spanning Tree Protocol (RSTP) mode
      stp   Spanning Tree Protocol (STP) mode
    
    [SWA]stp mode stp        //修改生成树模式为STP
    Info: This operation may take a few seconds. Please wait for a moment...done.
    [SWA]
    Jun  7 2019 23:19:36-08:00 SWA DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
    .191.3.1 configurations have been changed. The current change number is 7, the c
    hange loop count is 0, and the maximum number of records is 4095.
    [SWA]dis stp         //查看STP协议状态
    -------[CIST Global Info][Mode STP]-------     //默认配置已改为STP(SWB如法炮制,也改为STP)
    CIST Bridge         :32768.4c1f-cca8-6f8e
    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-cc27-5e6e / 20000
    CIST RegRoot/IRPC   :32768.4c1f-cca8-6f8e / 0
    CIST RootPortId     :128.25
    BPDU-Protection     :Disabled
    TC or TCN received  :26
    TC count per hello  :2
    STP Converge Mode   :Normal 
    Time since last TC  :0 days 0h:30m:21s
    Number of TC        :2
    Last TC occurred    :GigabitEthernet0/0/3
    ----   -- more --    ----
    [SWA]
    [SWA]stp priority ?    //修改桥优先级
      INTEGER<0-61440>  Bridge priority, in steps of 4096    //输入的桥优先级必须是4096的倍数
    
    [SWA]stp priority 0    //修改SWA的桥优先级为0(SWA配置为根桥,因为SWB的桥优先级还是32678)
    [SWA]
    Jun  7 2019 23:39:36-08:00 SWA DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
    .191.3.1 configurations have been changed. The current change number is 8, the c
    hange loop count is 0, and the maximum number of records is 4095.
    [SWA]dis stp
    -------[CIST Global Info][Mode STP]-------
    CIST Bridge         :0    .4c1f-cca8-6f8e
    Config Times        :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
    Active Times        :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
    CIST Root/ERPC      :0    .4c1f-cca8-6f8e / 0
    CIST RegRoot/IRPC   :0    .4c1f-cca8-6f8e / 0
    CIST RootPortId     :0.0
    BPDU-Protection     :Disabled
    TC or TCN received  :81
    TC count per hello  :0
    STP Converge Mode   :Normal 
    Time since last TC  :0 days 0h:12m:59s
    Number of TC        :6
    Last TC occurred    :GigabitEthernet0/0/1
      ---- More ----
    [SWB]dis stp bri     //查看配置(STP协议收敛后,SWB的G0/0/1端口成为了根端口)
     MSTID  Port                        Role  STP State     Protection
       0    GigabitEthernet0/0/1        ROOT  DISCARDING      NONE
       0    GigabitEthernet0/0/2        ALTE  DISCARDING      NONE
       0    GigabitEthernet0/0/3        DESI  FORWARDING      NONE
    ====================================
    [SWA]int g0/0/1       //进入SWA的G0/0/1端口配置
    [SWA-GigabitEthernet0/0/1]stp port priority ?         //查询修改端口优先级的命令
      INTEGER<0-240>  Port priority, in steps of 16        //优先级按16的倍数调整(默认为128)
    
    [SWA-GigabitEthernet0/0/1]stp port priority 240        //将SWA的G0/0/1端口优先级调整为240(大于128)
    [SWA-GigabitEthernet0/0/1]
    Jun  7 2019 23:51:47-08:00 SWA DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
    .191.3.1 configurations have been changed. The current change number is 9, the c
    hange loop count is 0, and the maximum number of records is 4095.
    [SWA-GigabitEthernet0/0/1]q
    [SWA]     //(或者配置SWA的G0/0/2端口,修改优先级为16,小于128。这样也可以实现实验效果)
    ====================================
    [SWB]dis stp bri     //查看配置(修改SWA的G0/0/1端口优先级后,SWB的G0/0/2端口成为了根端口)
     MSTID  Port                        Role  STP State     Protection
       0    GigabitEthernet0/0/1        ALTE  DISCARDING      NONE
       0    GigabitEthernet0/0/2        ROOT  FORWARDING      NONE      //SWB的G0/0/2端口被选举为根端口
       0    GigabitEthernet0/0/3        DESI  FORWARDING      NONE
    [SWB]dis stp int g0/0/1       //查看G0/0/1端口下STP协议状态(关于配置根端口,还可以通过修改端口开销PC使G0/0/2成为根端口)
    -------[CIST Global Info][Mode STP]-------
    CIST Bridge         :32768.4c1f-cc27-5e6e
    Config Times        :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
    Active Times        :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
    CIST Root/ERPC      :0    .4c1f-cca8-6f8e / 20000       //根路径开销RPC为20000
    CIST RegRoot/IRPC   :32768.4c1f-cc27-5e6e / 0
    CIST RootPortId     :128.1
    BPDU-Protection     :Disabled
    TC or TCN received  :114
    TC count per hello  :0
    STP Converge Mode   :Normal 
    Time since last TC  :0 days 0h:25m:13s
    Number of TC        :18
    Last TC occurred    :GigabitEthernet0/0/1
    ----[Port1(GigabitEthernet0/0/1)][FORWARDING]----
     Port Protocol       :Enabled
     Port Role           :Root Port
     Port Priority       :128
     Port Cost(Dot1T )   :Config=auto / Active=20000       //G0/0/1端口开销PC为20000
     Designated Bridge/Port   :0.4c1f-cca8-6f8e / 128.25
     Port Edged          :Config=default / Active=disabled
     Point-to-point      :Config=auto / Active=true
     Transit Limit       :147 packets/hello-time
     Protection Type     :None
     Port STP Mode       :STP 
     Port Protocol Type  :Config=auto / Active=dot1s
     BPDU Encapsulation  :Config=stp / Active=stp
     PortTimes           :Hello 2s MaxAge 20s FwDly 15s RemHop 0
     TC or TCN send      :18
     TC or TCN received  :53
     BPDU Sent           :367             
              TCN: 1, Config: 366, RST: 0, MST: 0
     BPDU Received       :1128             
              TCN: 0, Config: 1128, RST: 0, MST: 0
    ----[Port2(GigabitEthernet0/0/2)][DISCARDING]----
     Port Protocol       :Enabled
     Port Role           :Alternate Port
     Port Priority       :128
     Port Cost(Dot1T )   :Config=auto / Active=20000       //G0/0/2端口开销PC也是20000
     Designated Bridge/Port   :0.4c1f-cca8-6f8e / 128.26
     Port Edged          :Config=default / Active=disabled
     Point-to-point      :Config=auto / Active=true
     Transit Limit       :147 packets/hello-time
     Protection Type     :None
     Port STP Mode       :STP 
     Port Protocol Type  :Config=auto / Active=dot1s
     BPDU Encapsulation  :Config=stp / Active=stp
     PortTimes           :Hello 2s MaxAge 20s FwDly 15s RemHop 0
     TC or TCN send      :19
     TC or TCN received  :53
     BPDU Sent           :369             
              TCN: 2, Config: 367, RST: 0, MST: 0
     BPDU Received       :1402             
              TCN: 0, Config: 1402, RST: 0, MST: 0
      ---- More ----
    
    [SWB]int g0/0/1
    [SWB-GigabitEthernet0/0/1]stp cost ?      //查询修改端口(路径)开销的命令
      INTEGER<1-200000000>  Port path cost
    
    [SWB-GigabitEthernet0/0/1]stp cost 30000    //修改G0/0/1的端口开销为30000(大于G0/0/2的端口开销20000)
    [SWB-GigabitEthernet0/0/1]
    Jun  8 2019 00:34:18-08:00 SWB DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
    .191.3.1 configurations have been changed. The current change number is 6, the c
    hange loop count is 0, and the maximum number of records is 4095.
    [SWB-GigabitEthernet0/0/1]q
                      //(或者将G0/0/2的端口开销调小为1999,小于20000。这样也可以实现实验效果)
    [SWB]dis stp bri
     MSTID  Port                        Role  STP State     Protection
       0    GigabitEthernet0/0/1        ALTE  DISCARDING      NONE
       0    GigabitEthernet0/0/2        ROOT  FORWARDING      NONE     //端口G0/0/2被选举为根端口
       0    GigabitEthernet0/0/3        DESI  FORWARDING      NONE
    [SWB]      
    [SWB]int g0/0/3
    [SWB-GigabitEthernet0/0/3]stp edged-port ?         //查询边缘端口配置命令
      disable  Disable edge port
      enable   Enable edge port
    
    [SWB-GigabitEthernet0/0/3]stp edged-port enable        //配置G0/0/3端口为边缘端口
    [SWB-GigabitEthernet0/0/3]
    Jun  8 2019 00:48:48-08:00 SWB DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
    .191.3.1 configurations have been changed. The current change number is 7, the c
    hange loop count is 0, and the maximum number of records is 4095.
    
    [SWB-GigabitEthernet0/0/3]dis stp int g0/0/3
    -------[CIST Global Info][Mode STP]-------
    CIST Bridge         :32768.4c1f-cc27-5e6e
    Config Times        :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
    Active Times        :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
    CIST Root/ERPC      :0    .4c1f-cca8-6f8e / 20000
    CIST RegRoot/IRPC   :32768.4c1f-cc27-5e6e / 0
    CIST RootPortId     :128.2
    BPDU-Protection     :Disabled
    TC or TCN received  :185
    TC count per hello  :0
    STP Converge Mode   :Normal 
    Time since last TC  :0 days 0h:14m:58s
    Number of TC        :21
    Last TC occurred    :GigabitEthernet0/0/2
    ----[Port3(GigabitEthernet0/0/3)][FORWARDING]----
     Port Protocol       :Enabled
     Port Role           :Designated Port
     Port Priority       :128
     Port Cost(Dot1T )   :Config=auto / Active=20000
     Designated Bridge/Port   :32768.4c1f-cc27-5e6e / 128.3
     Port Edged          :Config=enabled / Active=enabled     //端口G0/0/3已配置为边缘端口,且为活动状态
     Point-to-point      :Config=auto / Active=true
     Transit Limit       :147 packets/hello-time
     Protection Type     :None
     Port STP Mode       :STP 
     Port Protocol Type  :Config=auto / Active=dot1s
     BPDU Encapsulation  :Config=stp / Active=stp
     PortTimes           :Hello 2s MaxAge 20s FwDly 15s RemHop 20
     TC or TCN send      :136
     TC or TCN received  :0
     BPDU Sent           :2309             
              TCN: 0, Config: 2309, RST: 0, MST: 0
     BPDU Received       :0             
              TCN: 0, Config: 0, RST: 0, MST: 0
    [SWB-GigabitEthernet0/0/3] 
    之所以开博客,纯为记录自己学习的过程,以便查缺补漏。如有参考我的博客,不清晰的地方可以留言或者加好友交流,以助共同进步。
  • 相关阅读:
    函数 free 的原型
    malloc 返回值的类型是 void *
    malloc 函数本身并不识别要申请的内存是什么类型
    用 free 或 delete 释放了内存之后,立即将指针设置为 NULL,防止产 生“野指针”
    动态内存的申请与释放必须配对,防止内存泄漏
    避免数组或指针的下标越界,特别要当心发生“多 1”或者“少 1” 操作
    不要忘记为数组和动态内存赋初值
    用 malloc 或 new 申请内存之后,应该立即检查指针值是否为 NULL
    释放了内存却继续使用它
    忘记了释放内存,造成内存泄露
  • 原文地址:https://www.cnblogs.com/ict-tang/p/10989758.html
Copyright © 2011-2022 走看看