【思唯网络】生成树(STP)配置示例
首页 > >   作者:浙江思唯网络  2019年11月22日 17:29 星期五  字号:   评论:0 条
时间:2019-11-22 17:29   评论:0 条 
如下图为某小型企业网络结构图
    默认要求阻塞交换机S2与S1之间的链路以免发生环路,当核心交换机S1与S2或S3之间出现链路故障时又能从S2和S3连通到核心交换机S1.
    默认要求阻塞S2的GE0/0/2端口

具体配置
[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     isabled
CIST Root Type      rimary 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 #7为0
[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  #7位0
#
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     isabled
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  #8位0
[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  # 8位0
#
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     isabled
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关闭表示已经阻塞

-------------
现在假如核心交换机S1与S3之间出现故障,用[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 #以及从阻塞状态切换为转发状态
--------------

目前CCIE RS 笔试和LAB 稳定,持续过人中,了解之前的PASS情况和咨询考试情况

请加QQ:804990984 , 839898248

技术交流请加群:859273036,备注博客

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

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