生成树(STP)配置示例
首页 > HuaWei > 破环配置   作者:浙江思唯网络  2015年10月8日 12:13 星期四  字号:   评论:0 条
时间:2015-10-8 12:13   评论:0 条 
 

  如下图为某小型企业网络结构图

    默认要求阻塞交换机S2S1之间的链路以免发生环路,当核心交换机S1S2S3之间出现链路故障时又能从S2S3连通到核心交换机S1.

    默认要求阻塞S2GE0/0/2端口生成树(STP)配置示例.png

 

具体配置

[s1]stp mode stp   

[s1]stp enable

[s1]stp root primary  #设置为根交换机

[s1]stp priority ?

  INTEGER<0-61440>  Bridge priority, in steps of 4096 #数值越小越能称为根交换机

-----------------------

<s1>dis cu

#

sysname s1

#

vlan batch 10 20 200

#

stp mode stp

stp instance 0 root primary #设置为根交换机

interface Vlanif1

#

interface Vlanif10

 ip address 192.168.10.254 255.255.255.0

#

interface Vlanif20

 ip address 192.168.20.254 255.255.255.0

#

interface Vlanif200

 ip address 192.168.200.254 255.255.255.0

#

interface MEth0/0/1

#

interface GigabitEthernet0/0/1

 port link-type trunk

 port trunk allow-pass vlan 2 to 4094

#

interface GigabitEthernet0/0/2

 port link-type trunk

 port trunk allow-pass vlan 2 to 4094

#

interface GigabitEthernet0/0/23

 port link-type access

 port default vlan 200

#

interface GigabitEthernet0/0/24

 port link-type access

#

return

<s1>

--------------

<s1>display stp

-------[CIST Global Info][Mode STP]-------

CIST Bridge         :0    .4c1f-cc0c-7730  # 0表示根交换机

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-cc0c-7730 / 0

CIST RegRoot/IRPC   :0    .4c1f-cc0c-7730 / 0

CIST RootPortId     :0.0

BPDU-Protection     :Disabled

CIST Root Type      :Primary root

TC or TCN received  :10

TC count per hello  :0

STP Converge Mode   :Normal

Time since last TC  :0 days 0h:23m:15s

Number of TC        :18

Last TC occurred    :GigabitEthernet0/0/2

-------------------------

<s1>display stp brief

 MSTID  Port                        Role  STP State     Protection

   0    GigabitEthernet0/0/1        DESI  FORWARDING      NONE

   0    GigabitEthernet0/0/2        DESI  FORWARDING      NONE

   0    GigabitEthernet0/0/3        DESI  FORWARDING      NONE

   0    GigabitEthernet0/0/23       DESI  FORWARDING      NONE

==========================

[s3]stp mode  stp 

[s3]stp enable

[s3-GigabitEthernet0/0/1]stp cost 1 #设置端口开销值 数值越小越能称为根端口,越大越可能成为阻塞端口

[s3-GigabitEthernet0/0/2]stp cost 20000000 #70

[s3]stp root secondary  #设置为备份交换机

----------

<s3>dis cu

#

sysname s3

#

vlan batch 10 20

#

stp mode stp

stp instance 0 root secondary #备份交换机

#

interface Vlanif1

#

interface MEth0/0/1

#

interface Ethernet0/0/22

 port link-type access

 port default vlan 20

#

interface GigabitEthernet0/0/1

 port link-type trunk

 port trunk allow-pass vlan 2 to 4094

 stp instance 0 cost 1

#

interface GigabitEthernet0/0/2

 port link-type trunk

 port trunk allow-pass vlan 2 to 4094

 stp instance 0 cost 20000000  #70

#

return

<s3> 

----------------------

<s3>display stp

-------[CIST Global Info][Mode STP]-------

CIST Bridge         :4096 .4c1f-cc6a-9c8e  # 4096 表示备份交换机

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-cc0c-7730 / 1

CIST RegRoot/IRPC   :4096 .4c1f-cc6a-9c8e / 0

CIST RootPortId     :128.23

BPDU-Protection     :Disabled

CIST Root Type      :Secondary root

TC or TCN received  :80

TC count per hello  :0

STP Converge Mode   :Normal

Time since last TC  :0 days 0h:26m:9s

Number of TC        :18

Last TC occurred    :GigabitEthernet0/0/1

----------------------

<s3>display stp brief

 MSTID  Port                        Role  STP State     Protection

   0    Ethernet0/0/22              DESI  FORWARDING      NONE  # DESI 表示指定端口

   0    GigabitEthernet0/0/1        ROOT  FORWARDING      NONE  # root 表示根端口

   0    GigabitEthernet0/0/2        DESI  FORWARDING      NONE

============================

[s2]stp mode stp 

[s2]stp enable

[s2-GigabitEthernet0/0/2]stp cost 200000000  #80

[s2-GigabitEthernet0/0/1]stp  cost 1

-----------------

[s2]dis cu

#

sysname s2

#

vlan batch 10 20

#

stp mode stp

#

interface Vlanif1

#

interface Ethernet0/0/22

 port link-type access

 port default vlan 10

#

interface GigabitEthernet0/0/1

 port link-type trunk

 port trunk allow-pass vlan 2 to 4094

 stp instance 0 cost 1

#

interface GigabitEthernet0/0/2

 port link-type trunk

 port trunk allow-pass vlan 2 to 4094

 stp instance 0 cost 200000000  # 80

#

return

[s2] 

--------------

[s2] dis stp

-------[CIST Global Info][Mode STP]-------

CIST Bridge         :32768.4c1f-ccb2-e471

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-cc0c-7730 / 1

CIST RegRoot/IRPC   :32768.4c1f-ccb2-e471 / 0

CIST RootPortId     :128.23

BPDU-Protection     :Disabled

TC or TCN received  :139

TC count per hello  :0

STP Converge Mode   :Normal

Time since last TC  :0 days 0h:34m:35s

Number of TC        :16

Last TC occurred    :GigabitEthernet0/0/1

----------------

[s2]dis stp br

 MSTID  Port                        Role  STP State     Protection

   0    Ethernet0/0/22              DESI  FORWARDING      NONE

   0    GigabitEthernet0/0/1        ROOT  FORWARDING      NONE

   0    GigabitEthernet0/0/2        ALTE  DISCARDING      NONE  # DISCARDING关闭表示已经阻塞

-------------

现在假如核心交换机S1S3之间出现故障,用[s3-GigabitEthernet0/0/1]shutdown 模拟。

现在来看STP状态


[s3]dis stp br

 MSTID  Port                        Role  STP State     Protection

   0    Ethernet0/0/22              DESI  FORWARDING      NONE

   0    GigabitEthernet0/0/2        ROOT  FORWARDING      NONE #已经切换为根端口

-----------------

[s2]dis st br

 MSTID  Port                        Role  STP State     Protection

   0    Ethernet0/0/22              DESI  FORWARDING      NONE

   0    GigabitEthernet0/0/1        ROOT  FORWARDING      NONE

   0    GigabitEthernet0/0/2        DESI  FORWARDING      NONE #以及从阻塞状态切换为转发状态

--------------

QQ图片20151008121630.png

 

 您阅读这篇文章共花了: 
二维码加载中...
技术交流:欢迎在本文下方留言或加入QQ群:859273036 互相学习。     
本文地址:http://www.023wg.com/pohuan/17.html
版权声明:若无注明,本文皆为“Swiers思唯网络博客”原创,转载请保留文章出处。

返回顶部    首页   
版权所有:Swiers思唯网络博客    浙江思唯网络