当前位置:首页>微思动态 > >详情
全国热线电话 400-881-4699

在线留言

【华为】MSTP多生成配置案例

发布作者:微思网络   发布时间:2024-10-31   浏览量:0

微思推荐课程:
华为HCIA课程介绍
华为HCIP课程介绍
华为HCIE课程介绍

组网需求

在一个复杂的网络中,由于冗余备份的需要,网络规划者一般都倾向于在设备之间部署多条物理链路,其中一条作为主用链路,其他作为备份链路。这样就难免会形成环路,若网络中存在环路,可能会引起广播风暴和MAC表项被破坏。为此,可以在网络中部署MSTP协议预防环路。MSTP可阻塞二层网络中的冗余链路,将网络修剪成树状,达到消除环路的目的。

如图9-20所示,SwitchA、SwitchB、SwitchC和SwitchD都运行MSTP。为实现VLAN2~VLAN10和VLAN11~VLAN20的流量负载分担,MSTP引入了多实例。MSTP可设置VLAN映射表,把VLAN和生成树实例相关联。

微信图片_20241031160923.png

图9-20 配置MSTP功能组网图

配置思路

采用以下思路配置MSTP功能:

  1. 在处于环形网络中的交换设备上配置MSTP基本功能。

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

  3. 配置设备的二层转发功能。

操作步骤

  1. 配置MSTP基本功能

    1. 配置SwitchA、SwitchB、SwitchC和SwitchD到域名为RG1的域内,创建实例MSTI1和实例MSTI2

当两台交换设备的以下配置都相同时,这两台交换设备属于同一个MST域。

      • MST域的域名。

      • 多生成树实例和VLAN的映射关系。

不能将同一个VLAN映射到多个不同的实例上。如果将一个已经和实例建立映射关系的VLAN又映射到另一个实例上,原来的映射关系将被取消。

      • MST域的修订级别。

# 配置SwitchA的MST域。

<HUAWEI> system-view
[~HUAWEI] sysname SwitchA
[*HUAWEI] commit
[~SwitchA] stp region-configuration
[~SwitchA-mst-region] region-name RG1
[*SwitchA-mst-region] instance 1 vlan 2 to 10
[*SwitchA-mst-region] instance 2 vlan 11 to 20
[*SwitchA-mst-region] commit
[~SwitchA-mst-region] quit

# 配置SwitchB的MST域。

<HUAWEI> system-view
[~HUAWEI] sysname SwitchB
[*HUAWEI] commit
[~SwitchB] stp region-configuration
[~SwitchB-mst-region] region-name RG1
[*SwitchB-mst-region] instance 1 vlan 2 to 10
[*SwitchB-mst-region] instance 2 vlan 11 to 20
[*SwitchB-mst-region] commit
[~SwitchB-mst-region] quit

# 配置SwitchC的MST域。

<HUAWEI> system-view
[~HUAWEI] sysname SwitchC
[*HUAWEI] commit
[~SwitchC] stp region-configuration
[~SwitchC-mst-region] region-name RG1
[*SwitchC-mst-region] instance 1 vlan 2 to 10
[*SwitchC-mst-region] instance 2 vlan 11 to 20
[*SwitchC-mst-region] commit
[~SwitchC-mst-region] quit

# 配置SwitchD的MST域。

<HUAWEI> system-view
[~HUAWEI] sysname SwitchD
[*HUAWEI] commit
[~SwitchD] stp region-configuration
[~SwitchD-mst-region] region-name RG1
[*SwitchD-mst-region] instance 1 vlan 2 to 10
[*SwitchD-mst-region] instance 2 vlan 11 to 20
[*SwitchD-mst-region] commit
[~SwitchD-mst-region] quit

在域RG1内,配置MSTI1与MSTI2的根桥与备份根桥

  • 配置MSTI1的根桥与备份根桥

# 配置SwitchA为MSTI1的根桥。

[~SwitchA] stp instance 1 root primary
[*SwitchA] commit

# 配置SwitchB为MSTI1的备份根桥。

[~SwitchB] stp instance 1 root secondary
[*SwitchB] commit

      • 配置MSTI2的根桥与备份根桥

# 配置SwitchB为MSTI2的根桥。

[~SwitchB] stp instance 2 root primary
[*SwitchB] commit

# 配置SwitchA为MSTI2的备份根桥。

[~SwitchA] stp instance 2 root secondary
[*SwitchA] commit

    1. 配置实例MSTI1和MSTI2中将要被阻塞端口的路径开销值大于缺省值


# 配置SwitchA的端口路径开销值的计算方法为华为计算方法。

[~SwitchA] stp pathcost-standard legacy
[*SwitchA] commit

# 配置SwitchB的端口路径开销计算方法为华为计算方法。

[~SwitchB] stp pathcost-standard legacy
[*SwitchB] commit

# 配置SwitchC的端口路径开销计算方法为华为计算方法,将端口10GE1/0/2在实例MSTI2中的路径开销值配置为20000。

[~SwitchC] stp pathcost-standard legacy
[*SwitchC] interface 10ge 1/0/2
[*SwitchC-10GE1/0/2] stp instance 2 cost 20000
[*SwitchC-10GE1/0/2] commit
[~SwitchC-10GE1/0/2] quit

# 配置SwitchD的端口路径开销计算方法为华为计算方法,将端口10GE1/0/2在实例MSTI1中的路径开销值配置为20000。

[~SwitchD] stp pathcost-standard legacy
[*SwitchD] interface 10ge 1/0/2
[*SwitchD-10GE1/0/2] stp instance 1 cost 20000
[*SwitchD-10GE1/0/2] commit
[~SwitchD-10GE1/0/2] quit

    1. 使能MSTP,实现破除环路

      • 设备全局使能MSTP

# 在SwitchA上启动MSTP。

[~SwitchA] stp enable
[*SwitchA] commit

# 在SwitchB上启动MSTP。

[~SwitchB] stp enable
[*SwitchB] commit

# 在SwitchC上启动MSTP。

[~SwitchC] stp enable
[*SwitchC] commit

# 在SwitchD上启动MSTP。

[~SwitchD] stp enable
[*SwitchD] commit

      • 将与终端相连的端口去使能MSTP

# 配置SwitchC端口10GE1/0/1的STP去使能。

[~SwitchC] interface 10ge 1/0/1
[~SwitchC-10GE1/0/1] stp disable
[*SwitchC-10GE1/0/1] commit
[~SwitchC-10GE1/0/1] quit

# 配置SwitchD端口10GE1/0/1的STP去使能。

[~SwitchD] interface 10ge 1/0/1
[~SwitchD-10GE1/0/1] stp disable
[*SwitchD-10GE1/0/1] commit
[~SwitchD-10GE1/0/1] quit

  1. 配置保护功能,如在各实例的根桥设备的指定端口配置根保护功能

# 在SwitchA端口10GE1/0/1上启动根保护。

[~SwitchA] interface 10ge 1/0/1
[~SwitchA-10GE1/0/1] stp root-protection
[*SwitchA-10GE1/0/1] commit
[~SwitchA-10GE1/0/1] quit

# 在SwitchB端口10GE1/0/1上启动根保护。

[~SwitchB] interface 10ge 1/0/1
[~SwitchB-10GE1/0/1] stp root-protection
[*SwitchB-10GE1/0/1] commit
[~SwitchB-10GE1/0/1] quit

  1. 配置处于环网中的设备的二层转发功能

    • 在交换设备SwitchA、SwitchB、SwitchC和SwitchD上创建VLAN2~20

# 在SwitchA上创建VLAN2~20。

[~SwitchA] vlan batch 2 to 20
[*SwitchA] commit

# 在SwitchB上创建VLAN2~20。

[~SwitchB] vlan batch 2 to 20
[*SwitchB] commit

# 在SwitchC上创建VLAN2~20。

[~SwitchC] vlan batch 2 to 20
[*SwitchC] commit

# 在SwitchD上创建VLAN2~20。

[~SwitchD] vlan batch 2 to 20
[*SwitchD] commit

    • 将交换设备上接入环路中的端口加入VLAN

# 将SwitchA端口10GE1/0/1加入VLAN。

[~SwitchA] interface 10ge 1/0/1
[~SwitchA-10GE1/0/1] port link-type trunk
[*SwitchA-10GE1/0/1] port trunk allow-pass vlan 2 to 20
[*SwitchA-10GE1/0/1] commit
[~SwitchA-10GE1/0/1] quit

# 将SwitchA端口10GE1/0/2加入VLAN。

[~SwitchA] interface 10ge 1/0/2
[~SwitchA-10GE1/0/2] port link-type trunk
[*SwitchA-10GE1/0/2] port trunk allow-pass vlan 2 to 20
[*SwitchA-10GE1/0/2] commit
[~SwitchA-10GE1/0/2] quit

# 将SwitchB端口10GE1/0/1加入VLAN。

[~SwitchB] interface 10ge 1/0/1
[~SwitchB-10GE1/0/1] port link-type trunk
[*SwitchB-10GE1/0/1] port trunk allow-pass vlan 2 to 20
[*SwitchB-10GE1/0/1] commit
[~SwitchB-10GE1/0/1] quit

# 将SwitchB端口10GE1/0/2加入VLAN。

[~SwitchB] interface 10ge 1/0/2
[~SwitchB-10GE1/0/2] port link-type trunk
[*SwitchB-10GE1/0/2] port trunk allow-pass vlan 2 to 20
[*SwitchB-10GE1/0/2] commit
[~SwitchB-10GE1/0/2] quit

# 将SwitchC端口10GE1/0/1加入VLAN。

[~SwitchC] interface 10ge 1/0/1
[~SwitchC-10GE1/0/1] port link-type access
[*SwitchC-10GE1/0/1] port default vlan 2
[*SwitchC-10GE1/0/1] commit
[~SwitchC-10GE1/0/1] quit

# 将SwitchC端口10GE1/0/2加入VLAN。

[~SwitchC] interface 10ge 1/0/2
[~SwitchC-10GE1/0/2] port link-type trunk
[*SwitchC-10GE1/0/2] port trunk allow-pass vlan 2 to 20
[*SwitchC-10GE1/0/2] commit
[~SwitchC-10GE1/0/2] quit

# 将SwitchC端口10GE1/0/3加入VLAN。

[~SwitchC] interface 10ge 1/0/3
[~SwitchC-10GE1/0/3] port link-type trunk
[*SwitchC-10GE1/0/3] port trunk allow-pass vlan 2 to 20
[*SwitchC-10GE1/0/3] commit
[~SwitchC-10GE1/0/3] quit

# 将SwitchD端口10GE1/0/1加入VLAN。

[~SwitchD] interface 10ge 1/0/1
[~SwitchD-10GE1/0/1] port link-type access
[*SwitchD-10GE1/0/1] port default vlan 11
[*SwitchD-10GE1/0/1] commit
[~SwitchD-10GE1/0/1] quit

# 将SwitchD端口10GE1/0/2加入VLAN。

[~SwitchD] interface 10ge 1/0/2
[~SwitchD-10GE1/0/2] port link-type trunk
[*SwitchD-10GE1/0/2] port trunk allow-pass vlan 2 to 20
[*SwitchD-10GE1/0/2] commit
[~SwitchD-10GE1/0/2] quit

# 将SwitchD端口10GE1/0/3加入VLAN。

[~SwitchD] interface 10ge 1/0/3
[~SwitchD-10GE1/0/3] port link-type trunk
[*SwitchD-10GE1/0/3] port trunk allow-pass vlan 2 to 20
[*SwitchD-10GE1/0/3] commit
[~SwitchD-10GE1/0/3] quit

  1. 验证配置结果

在网络计算稳定后,执行以下操作,验证配置结果。

# 在SwitchA上执行display stp brief命令,查看端口状态和端口的保护类型,结果如下:

[~SwitchA] display stp brief
MSTID  Port             Role  STP State       Protection  Cost       Edged
    0  10GE1/0/1        DESI  forwarding      root           2       disable
    0  10GE1/0/2        DESI  forwarding      none           2       disable
    1  10GE1/0/1        DESI  forwarding      root           2       disable
    1  10GE1/0/2        DESI  forwarding      none           2       disable
    2  10GE1/0/1        DESI  forwarding      root           2       disable
    2  10GE1/0/2        ROOT  forwarding      none           2       disable

在MSTI1中,由于SwitchA是根桥,SwitchA的端口10GE1/0/2和10GE1/0/1成为指定端口。在MSTI2中,SwitchA的端口10GE1/0/1成为指定端口,端口10GE1/0/2成为根端口。

# 在SwitchB上执行display stp brief命令,结果如下:

[~SwitchB] display stp brief
MSTID  Port             Role  STP State       Protection  Cost       Edged
    0  10GE1/0/1        DESI  forwarding      root           2       disable
    0  10GE1/0/2        ROOT  forwarding      none           2       disable
    1  10GE1/0/1        DESI  forwarding      root           2       disable
    1  10GE1/0/2        ROOT  forwarding      none           2       disable
    2  10GE1/0/1        DESI  forwarding      root           2       disable
    2  10GE1/0/2        DESI  forwarding      none           2       disable

在MSTI2中,由于SwitchB是根桥,端口10GE1/0/1和10GE1/0/2在MSTI2中成为指定端口。在MSTI1中,SwitchB的端口10GE1/0/1成为指定端口,端口10GE1/0/2成为根端口。

# 在SwitchC上执行display stp interface brief命令,结果如下:

[~SwitchC] display stp interface 10ge 1/0/3 brief
MSTID  Port             Role  STP State       Protection  Cost       Edged
    0  10GE1/0/3        ROOT  forwarding      none           2       disable
    1  10GE1/0/3        ROOT  forwarding      none           2       disable
    2  10GE1/0/3        ROOT  forwarding      none           2       disable

[~SwitchC] display stp interface 10ge 1/0/2 brief
MSTID  Port             Role  STP State       Protection  Cost       Edged
    0  10GE1/0/2        DESI  forwarding      none           2       disable
    1  10GE1/0/2        DESI  forwarding      none           2       disable
    2  10GE1/0/2        ALTE  discarding      none       20000       disable

SwitchC的端口10GE1/0/3在MSTI1和MSTI2中为根端口。SwitchC的另一个端口10GE1/0/2,在MSTI2中被阻塞,在MSTI1中被计算为指定端口。

# 在SwitchD上执行display stp interface brief命令,结果如下:

[~SwitchD] display stp interface 10ge 1/0/3 brief
MSTID  Port             Role  STP State       Protection  Cost       Edged
    0  10GE1/0/3        ALTE  discarding      none           2       disable
    1  10GE1/0/3        ROOT  forwarding      none           2       disable
    2  10GE1/0/3        ROOT  forwarding      none           2       disable

[~SwitchD] display stp interface 10ge 1/0/2 brief
MSTID  Port             Role  STP State       Protection  Cost       Edged
    0  10GE1/0/2        ROOT  forwarding      none           2       disable
    1  10GE1/0/2        ALTE  discarding      none       20000       disable
    2  10GE1/0/2        DESI  forwarding      none           2       disable

SwitchD的端口10GE1/0/3在MSTI1和MSTI2中为根端口。SwitchD的另一个端口10GE1/0/2,在MSTI1中被阻塞,在MSTI2中被计算为指定端口。


点击查看相关文章:
华为设备二层交换技术——MSTP协议详解
【技术分享】MSTP配置
【案例分享】多生成树MSTP配置



返回顶部