H3C  MSTP、RSTP案例配置

发布时间:2019-08-18 09:20:55编辑:auto阅读(1818)

    1.MSTP配置

    H3C  MSTP、RSTP案例配置

    1.配置 VLAN 和端口
    请按照图1-12在Device A和Device B上分别创建VLAN 10、20和30,在Device C上创建VLAN 10、
    20 和 40,在Device D上创建VLAN 20、30 和 40;将各设备的各端口配置为Trunk端口并允许相应
    的VLAN通过,具体配置:
    DeviceA
    sys
    vlan 10
    vlan 20
    vlan 30
    inter g 1/0/1
    port link-type trunk
    port trunk permit vlan 10 20
    quit
    inter g 1/0/2
    port link-type trunk
    port trunk permit vlan 20 30
    quit
    inter g 1/0/3
    port link-type trunk
    port trunk permit vlan all
    quit
    
    DeviceB
    sys
    vlan 10
    vlan 20
    vlan 30
    inter g 1/0/1
    port link-type trunk
    port trunk permit vlan 20 30
    quit
    inter g 1/0/2
    port link-type trunk
    port trunk permit vlan 10 20
    quit
    inter g 1/0/3
    port link-type trunk
    port trunk permit vlan all
    quit
    
    DeviceC
    sys
    vlan 10
    vlan 20
    vlan 40
    inter g 1/0/1
    port link-type trunk
    port trunk permit vlan 10 20
    quit
    inter g 1/0/2
    port link-type trunk
    port trunk permit vlan 10 20
    quit
    inter g 1/0/3
    port link-type trunk
    port trunk permit vlan 20 40
    quit
    
    DeviceD
    sys
    vlan 20
    vlan 30
    vlan 40
    inter g 1/0/1
    port link-type trunk
    port trunk permit vlan 20 30
    quit
    inter g 1/0/2
    port link-type trunk
    port trunk permit vlan 20 30
    quit
    inter g 1/0/3
    port link-type trunk
    port trunk permit vlan 20 40
    quit
    2 配置 Device A
    # 配置 MST 域的域名为 example,将 VLAN 10、30、40 
    分别映射到 MSTI 1、3、4 上,并配置MSTP 的修订级别为 0。
    <DeviceA> system-view
    [DeviceA] stp region-configuration
    [DeviceA-mst-region] region-name example
    [DeviceA-mst-region] instance 1 vlan 10
    [DeviceA-mst-region] instance 3 vlan 30
    [DeviceA-mst-region] instance 4 vlan 40
    [DeviceA-mst-region] revision-level 0
    # 激活 MST 域的配置。
    [DeviceA-mst-region] active region-configuration
    [DeviceA-mst-region] quit
    # 配置本设备为 MSTI 1 的根桥。
    [DeviceA] stp instance 1 root primary
    # 全局使能生成树协议。
    [DeviceA] stp global enable
    3 配置 Device B
    # 配置 MST 域的域名为 example,将 VLAN 10、30、40 
    分别映射到 MSTI 1、3、4 上,并配置MSTP 的修订级别为 0。
    <DeviceB> system-view
    [DeviceB] stp region-configuration
    [DeviceB-mst-region] region-name example
    [DeviceB-mst-region] instance 1 vlan 10
    [DeviceB-mst-region] instance 3 vlan 30
    [DeviceB-mst-region] instance 4 vlan 40
    [DeviceB-mst-region] revision-level 0
    # 激活 MST 域的配置。
    [DeviceB-mst-region] active region-configuration
    [DeviceB-mst-region] quit
    # 配置本设备为 MSTI 3 的根桥。
    [DeviceB] stp instance 3 root primary
    # 全局使能生成树协议。
    [DeviceB] stp global enable
    4 配置 Device C
    # 配置 MST 域的域名为 example,将 VLAN 10、30、40 
    分别映射到 MSTI 1、3、4 上,并配置MSTP 的修订级别为 0。
    <DeviceC> system-view
    [DeviceC] stp region-configuration
    [DeviceC-mst-region] region-name example
    [DeviceC-mst-region] instance 1 vlan 10
    [DeviceC-mst-region] instance 3 vlan 30
    [DeviceC-mst-region] instance 4 vlan 40
    [DeviceC-mst-region] revision-level 0
    # 激活 MST 域的配置。
    [DeviceC-mst-region] active region-configuration
    [DeviceC-mst-region] quit
    # 配置本设备为 MSTI 4 的根桥。
    [DeviceC] stp instance 4 root primary
    # 全局使能生成树协议。
    [DeviceC] stp global enable
    5 配置 Device D
    # 配置 MST 域的域名为 example,将 VLAN 10、30、40 
    分别映射到 MSTI 1、3、4 上,并配置
    MSTP 的修订级别为 0。
    <DeviceD> system-view
    [DeviceD] stp region-configuration
    [DeviceD-mst-region] region-name example
    [DeviceD-mst-region] instance 1 vlan 10
    [DeviceD-mst-region] instance 3 vlan 30
    [DeviceD-mst-region] instance 4 vlan 40
    [DeviceD-mst-region] revision-level 0
    # 激活 MST 域的配置。
    [DeviceD-mst-region] active region-configuration
    [DeviceD-mst-region] quit
    # 全局使能生成树协议。
    [DeviceD] stp global enable
    
    6 验证配置
    当网络拓扑稳定后,通过使用 display stp brief 命令可以查看各设备上生成树的简要信息。
    具体情况根据虚拟设备MAC地址可能有不同。
    
    [DeviceA]dis stp brief
     MST ID   Port                                Role  STP State   Protection
     0        GigabitEthernet1/0/1                DESI  FORWARDING  NONE
     0        GigabitEthernet1/0/2                DESI  FORWARDING  NONE
     0        GigabitEthernet1/0/3                DESI  FORWARDING  NONE
     1        GigabitEthernet1/0/1                DESI  FORWARDING  NONE
     1        GigabitEthernet1/0/3                DESI  FORWARDING  NONE
     3        GigabitEthernet1/0/1                DESI  DISCARDING  NONE
     3        GigabitEthernet1/0/2                DESI  FORWARDING  NONE
     3        GigabitEthernet1/0/3                ROOT  FORWARDING  NONE
    
    [DeviceB]dis stp brief
     MST ID   Port                                Role  STP State   Protection
     0        GigabitEthernet1/0/1                DESI  FORWARDING  NONE
     0        GigabitEthernet1/0/2                DESI  FORWARDING  NONE
     0        GigabitEthernet1/0/3                ROOT  FORWARDING  NONE
     1        GigabitEthernet1/0/2                DESI  FORWARDING  NONE
     1        GigabitEthernet1/0/3                ROOT  FORWARDING  NONE
     3        GigabitEthernet1/0/1                DESI  FORWARDING  NONE
     3        GigabitEthernet1/0/3                DESI  FORWARDING  NONE
    
    [DeviceC]dis stp brief
     MST ID   Port                                Role  STP State   Protection
     0        GigabitEthernet1/0/1                ROOT  FORWARDING  NONE
     0        GigabitEthernet1/0/2                ALTE  DISCARDING  NONE
     0        GigabitEthernet1/0/3                DESI  FORWARDING  NONE
     1        GigabitEthernet1/0/1                ROOT  FORWARDING  NONE
     1        GigabitEthernet1/0/2                ALTE  DISCARDING  NONE
     4        GigabitEthernet1/0/3                DESI  FORWARDING  NONE
    
     [DeviceD]dis stp brief
    MST ID   Port                                Role  STP State   Protection
     0        GigabitEthernet1/0/1                ALTE  DISCARDING  NONE
     0        GigabitEthernet1/0/2                ROOT  FORWARDING  NONE
     0        GigabitEthernet1/0/3                ALTE  DISCARDING  NONE
     3        GigabitEthernet1/0/1                ROOT  FORWARDING  NONE
     3        GigabitEthernet1/0/2                ALTE  DISCARDING  NONE
     4        GigabitEthernet1/0/3                ROOT  FORWARDING  NONE
    

    2.RSTP配置

    H3C  MSTP、RSTP案例配置

    如 图 4所示,用户局域网内采用分层组网:
    • Device A 为核心层交换机; • Device B、Device C 为汇聚层交换机,Device C 和 Device B 之间通过两条链路相连;
    • Device D、Device E、Device F 为接入层交换机,下面直接挂接用户的 PC。
    • 本例中假定所有设备的端口路径开销相同。 现要求使用 RSTP 技术阻断二层环路,实现链路备份。具体应用需求如下:
    • 配置 Device A 为根桥,并保护根桥不被维护人员的错误配置或网络中的恶意影响。
    • Device C 为 Device B 的备份交换机,当 Device B 出现故障的时候,由 Device C 转发数据。
    • 配置 Device D、E、F 直接与用户相连的端口为边缘端口,并使能 BPDU 保护功能。
    • 保护网络的稳定性,防止网络被伪造的 TC-BPDU 恶意

    
    (1) 配置 Device A 
    # 配置设备工作在 RSTP 模式。 
    <DeviceA> system-view  
    [DeviceA] stp mode rstp 
    # 配置 Device A 为树根。 
    [DeviceA] stp root primary 
    
    配置 Device A 为树根还有一种方法,就是将设备的 Bridge 优先级配置为 0
    [DeviceA] stp priority 0  
    
    # 在与 Device B、Device C 相连的指定端口上启动根保护功能 
    [DeviceA] interface GigabitEthernet 2/0/1 
    [DeviceA-GigabitEthernet2/0/1] stp root-protection 
    [DeviceA-GigabitEthernet2/0/1] quit 
    [DeviceA] interface GigabitEthernet 2/0/2 
    [DeviceA-GigabitEthernet2/0/2] stp root-protection 
    [DeviceA-GigabitEthernet2/0/2] quit 
    # 启动 Device A 的 TC 防***功能。缺省情况下,该功能处于开启状态。 
    [DeviceA] stp tc-protection enable 
    # 全局启动 RSTP 功能。 
    [DeviceA] stp enable 
    # 全局执行 mcheck 操作确保设备各端口都工作于 RSTP 模式。 
    [DeviceA] stp mcheck 
    # 全局启动 RSTP 功能后,各个端口的 RSTP 默认为启动状态,在不参与 RSTP 计算的端口上关闭
    STP,注意不要将参与 RSTP 计算的端口 STP 关闭。(此处仅列举出 GigabitEthernet 2/0/4) 
    [DeviceA] interface GigabitEthernet 2/0/4 
    [DeviceA-GigabitEthernet2/0/4] undo stp enable 
    [DeviceA-GigabitEthernet2/0/4] quit 
    
    
    (2) 配置 Device B 
    # 配置设备工作在 RSTP 模式。 
    <DeviceB> system-view  
    [DeviceB] stp mode rstp 
    # 配置 Device B 的 Bridge 优先级为 4096。 
    [DeviceB] stp priority 4096 
    # 在各个指定端口上启动根保护功能 
    [DeviceB] interface GigabitEthernet 1/0/4 
    [DeviceB-GigabitEthernet1/0/4] stp root-protection 
    [DeviceB-GigabitEthernet1/0/4] quit 
    [DeviceB] interface GigabitEthernet 1/0/5 
    [DeviceB-GigabitEthernet1/0/5] stp root-protection 
    [DeviceB-GigabitEthernet1/0/5] quit 
    [DeviceB] interface GigabitEthernet 1/0/6 
    [DeviceB-GigabitEthernet1/0/6] stp root-protection 
    [DeviceB-GigabitEthernet1/0/6] quit 
    # STP 时间参数、端口上的参数都采用缺省值。 
    # 全局启动 RSTP 功能。 
    [DeviceB] stp enable 
    # 全局执行 mcheck 操作确保设备各端口都工作于 RSTP 模式。 
    [DeviceB] stp mcheck 
    # 全局启动 RSTP 功能后,各个端口的 RSTP 默认为启动状态,在不参与 RSTP 计算的端口上关闭
    STP,注意不要将参与 RSTP 计算的端口 STP 关闭。(此处仅列举出 GigabitEthernet 1/0/8) 
    [DeviceB] interface GigabitEthernet 1/0/8 
    [DeviceB-GigabitEthernet1/0/8] undo stp enable 
    [DeviceB-GigabitEthernet1/0/8] quit 
    (3) 配置 Device C 
    # 配置设备工作在 RSTP 模式。 
    <DeviceC> system-view  
    [DeviceC] stp mode rstp 
    # 配置 Device C 的 Bridge 优先级配置为 8192,充当 Device B 的备份交换机。 
    [DeviceC] stp priority 8192 
    # 在各个指定端口上启动根保护功能 
    [DeviceC] interface GigabitEthernet 1/0/4 
    [DeviceC-GigabitEthernet1/0/4] stp root-protection 
    [DeviceC-GigabitEthernet1/0/4] quit 
    [DeviceC] interface GigabitEthernet 1/0/5 
    [DeviceC-GigabitEthernet1/0/5] stp root-protection 
    [DeviceC-GigabitEthernet1/0/5] quit 
    [DeviceC] interface GigabitEthernet 1/0/6 
    [DeviceC-GigabitEthernet1/0/6] stp root-protection 
    [DeviceC-GigabitEthernet1/0/6] quit 
    # STP 的时间参数、端口上的参数都采用缺省值。 
    # 全局启动 RSTP 功能。 
    [DeviceC] stp enable 
    # 全局执行 mcheck 操作确保设备各端口都工作于 RSTP 模式。 
    [DeviceC] stp mcheck 
    # 全局启动 RSTP 功能后,各个端口的 RSTP 默认为启动状态,在不参与 RSTP 计算的端口上关闭
    STP,注意不要将参与 RSTP 计算的端口 STP 关闭。(此处仅列举出 GigabitEthernet 1/0/8) 
    [DeviceC] interface GigabitEthernet 1/0/8 
    [DeviceC-GigabitEthernet1/0/8] undo stp enable 
    [DeviceC-GigabitEthernet1/0/8] quit 
    (4) 配置 Device D 
    # 配置设备工作在 RSTP 模式。 
    <DeviceD> system-view  
    [DeviceD] stp mode rstp 
    # 将直接与用户相连的端口配置为边缘端口,并使能 BPDU 保护功能。(此处仅以 GigabitEthernet 
    1/0/4 为例) 
    [DeviceD] interface GigabitEthernet 1/0/4 
    [DeviceD-GigabitEthernet1/0/4] stp edged-port enable 
    [DeviceD-GigabitEthernet1/0/4] quit 
    [DeviceD] stp bpdu-protection 
    # STP 的时间参数、端口的其他参数都采用缺省值。 
    # 全局启动 RSTP 功能。 
    [DeviceD] stp enable 
    # 全局执行 mcheck 操作确保设备各端口都工作于 RSTP 模式。 
    [DeviceD] stp mcheck 
    # 全局启动 RSTP 功能后,各个端口的 RSTP 默认为启动状态,在不参与 RSTP 计算的端口上关闭
    STP,注意不要将参与 RSTP 计算的端口 STP 关闭。(此处仅列举出 GigabitEthernet 1/0/3) 
    [DeviceD] interface GigabitEthernet 1/0/3 
    [DeviceD-GigabitEthernet1/0/3] undo stp enable 
    [DeviceD-GigabitEthernet1/0/3] quit 
    (5) 配置 Device E 和 Device F 
    # Device E 和 F 的配置同 Device D,此处不再赘述
    # 验证配置 
    当网络拓扑稳定后,使用 display stp brief 命令查看各设备上生成树的简要信息。 
    # 查看 Device A 上生成树的简要信息。 
    [DeviceA] display stp brief 
     MSTID      Port                         Role  STP State     Protection 
       0        GigabitEthernet1/0/1         DESI  FORWARDING    ROOT 
       0        GigabitEthernet1/0/2         DESI  FORWARDING    ROOT 
    # 查看 Device B 上生成树的简要信息。 
    [DeviceB] display stp brief 
     MSTID      Port                         Role  STP State     Protection 
       0        GigabitEthernet1/0/1         ROOT  FORWARDING    NONE 
       0        GigabitEthernet1/0/2         DESI  FORWARDING    NONE 
       0        GigabitEthernet1/0/3         DESI  FORWARDING    NONE 
       0        GigabitEthernet1/0/4         DESI  FORWARDING    ROOT 
       0        GigabitEthernet1/0/5         DESI  FORWARDING    ROOT 
       0        GigabitEthernet1/0/6         DESI  FORWARDING    ROOT 
    # 查看 Device C 上生成树的简要信息。 
    [DeviceC] display stp brief 
    MSTID      Port                          Role  STP State     Protection 
       0        GigabitEthernet1/0/1         ROOT  FORWARDING    NONE 
       0        GigabitEthernet1/0/2         ALTE  DISCARDING    NONE 
       0        GigabitEthernet1/0/3         ALTE  DISCARDING    NONE 
       0        GigabitEthernet1/0/4         DESI  FORWARDING    ROOT 
       0        GigabitEthernet1/0/5         DESI  FORWARDING    ROOT 
       0        GigabitEthernet1/0/6         DESI  FORWARDING    ROOT 
    # 查看 Device D 上生成树的简要信息。 
    [DeviceD] display stp brief 
     MSTID      Port                         Role  STP State     Protection 
       0        GigabitEthernet1/0/1         ROOT  FORWARDING    NONE 
       0        GigabitEthernet1/0/2         ALTE  DISCARDING    NONE 
       0        GigabitEthernet1/0/4         DESI  FORWARDING    NONE 
    # 查看 Device E 上生成树的简要信息。 
    [DeviceE] display stp brief 
     MSTID      Port                         Role  STP State     Protection 
       0        GigabitEthernet1/0/1         ROOT  FORWARDING    NONE 
       0        GigabitEthernet1/0/2         ALTE  DISCARDING    NONE 
       0        GigabitEthernet1/0/4         DESI  FORWARDING    NONE 
    # 查看 Device F 上生成树的简要信息。 
    [DeviceF] display stp brief 
     MSTID      Port                         Role  STP State     Protection 
       0        GigabitEthernet1/0/1         ROOT  FORWARDING    NONE 
       0        GigabitEthernet1/0/2         ALTE  DISCARDING    NONE 
       0        GigabitEthernet1/0/4         DESI  FORWARDING    NONE 

关键字