华为交换机配置RSTP预防环路

发布时间:2020年03月09日 阅读:2101 次

1、网络拓扑2.jpg

2、配置思路


    1、在处于环形网络中的交换设备上配置RSTP基本功能,包括:

        配置环网中的设备生成树协议工作在RSTP模式。

        配置根桥和备份根桥设备。

        配置端口的路径开销值,实现将该端口阻塞。

        使能RSTP,实现破除环路。

        与PC机相连的端口不用参与RSTP计算,配置为边缘端口,并配置BPDU过滤。

    2、配置保护功能,实现对设备或链路的保护。例如:在根桥设备的指定端口配置根保护功能。

3、操作步骤


    1、配置交换机RSTP工作模式


    [SwitchA]stp mode rstp

 

    [SwitchB]stp mode rstp


    [SwitchC]stp mode rstp

 

    [SwitchD]stp mode rstp

    2、配置SwitchA为根桥,SwitchD为备份根桥


    [SwitchA]stp root primary

 

    [SwitchD]stp root secondary

    3、加大SwitchC端口G0/0/1的端口路径开销


    [SwitchC]interface  GigabitEthernet  0/0/1

    [SwitchC-GigabitEthernet0/0/1]stp  cost 20000

    [SwitchC-GigabitEthernet0/0/1]quit

    4、全局使能RSTP


    [SwitchA]stp enable

 

    [SwitchB]stp enable

 

    [SwitchC]stp enable

 

    [SwitchD]stp enable

    5、将与PC相连的端口配置为边缘端口并配置BPDU过滤


    [SwitchB]interface  GigabitEthernet 0/0/2

    [SwitchB-GigabitEthernet0/0/2]stp  edged-port enable

    [SwitchB-GigabitEthernet0/0/2]stp bpdu-filter enable

    [SwitchB-GigabitEthernet0/0/2]quit

 

    [SwitchC]interface  GigabitEthernet 0/0/2

    [SwitchC-GigabitEthernet0/0/2]stp  edged-port enable

    [SwitchC-GigabitEthernet0/0/2]stp bpdu-filter enable

    [SwitchC-GigabitEthernet0/0/2]quit

    6、在根桥设备的指定端口配置根保护功能


    [SwitchA]interface  GigabitEthernet 0/0/1

    [SwitchA-GigabitEthernet0/0/1]stp root-protection

    [SwitchA-GigabitEthernet0/0/1]quit

    [SwitchA]interface  GigabitEthernet  0/0/2

    [SwitchA-GigabitEthernet0/0/2]stp root-protection

    [SwitchA-GigabitEthernet0/0/2]quit

    7、查看结果


    [SwitchA]display stp brief 

     MSTID  Port                        Role  STP State     Protection

       0    GigabitEthernet0/0/1        DESI  FORWARDING      ROOT

       0    GigabitEthernet0/0/2        DESI  FORWARDING      ROOT

       0    GigabitEthernet0/0/3        DESI  FORWARDING      NONE

    将SwitchA配置为根桥后,与SwitchB、SwitchD相连的端口GigabitEthernet0/0/2和GigabitEthernet0/0/1在生成树计算中被选举为指定端口,并在指定端口上配置根保护功能。

    8、在SwitchB上执行display stp interface gigabitethernet 0/0/1 brief命令


    [SwitchB]display  stp interface GigabitEthernet 0/0/1 brief 

     MSTID  Port                        Role  STP State     Protection

       0    GigabitEthernet0/0/1        DESI  FORWARDING      NONE

    端口GigabitEthernet0/0/1在生成树选举中成为指定端口,处于Forwarding状态。

    9、在SwitchC上执行display stp brief命令


    [SwitchC]display  stp brief 

     MSTID  Port                        Role  STP State     Protection

       0    GigabitEthernet0/0/1        ALTE  DISCARDING      NONE

       0    GigabitEthernet0/0/2        DESI  FORWARDING      NONE

       0    GigabitEthernet0/0/3        ROOT  FORWARDING      NONE

    端口GE0/0/1在生成树选举中成为Alternate端口,处于DISCARDING状态。

    端口GE0/0/3在生成树选举中成为根端口,处于FORWARDING状态。

Tag:
相关文章

发表评论: