玩转华为ENSP模拟器系列 | 配置MSTP功能示例

素材来源:华为路由器配置指南

一边学习一边整理试验笔记,并与大家分享,侵权即删,谢谢支持!

附上汇总贴:玩转华为ENSP模拟器系列 | 合集_COCOgsta的博客-CSDN博客_ensp实验大全


组网需求

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

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

配置思路

  • 在处于环形网络中的交换设备上配置MSTP基本功能。
  • 配置保护功能,实现对设备或链路的保护。例如:在各实例的根桥设备指定端口配置根保护功能。
  • 配置设备的二层转发功能。

操作步骤

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

# 配置SwitchA的MST域。

stp region-configuration
 region-name RG1
 instance 1 vlan 2 to 10
 instance 2 vlan 11 to 20

# 配置SwitchB的MST域。

stp region-configuration
 region-name RG1
 instance 1 vlan 2 to 10
 instance 2 vlan 11 to 20

# 配置SwitchC的MST域。

stp region-configuration
 region-name RG1
 instance 1 vlan 2 to 10
 instance 2 vlan 11 to 20

# 配置SwitchD的MST域。

stp region-configuration
 region-name RG1
 instance 1 vlan 2 to 10
 instance 2 vlan 11 to 20
  1. 在域RG1内,配置MSTI1与MSTI2的根桥与备份根桥
  • 配置MSTI1的根桥与备份根桥

# 配置SwitchA为MSTI1的根桥。

stp instance 1 root primary

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

stp instance 1 root secondary
  • 配置MSTI2的根桥与备份根桥

# 配置SwitchB为MSTI2的根桥。

stp instance 2 root primary

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

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

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

stp pathcost-standard legacy

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

stp pathcost-standard legacy

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

stp pathcost-standard legacy
interface GE1/0/0
 stp instance 2 cost 20000

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

stp pathcost-standard legacy
interface GE1/0/1
 stp instance 1 cost 20000
  1. 使能MSTP,实现破除环路
  • 设备全局使能MSTP

# 在SwitchA上启动MSTP。

stp enable

# 在SwitchB上启动MSTP。

stp enable

# 在SwitchC上启动MSTP。

stp enable

# 在SwitchD上启动MSTP。

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

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

interface GE1/0/2
 stp disable

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

interface GE1/0/2
 stp disable
  1. 配置保护功能,如在各实例的根桥设备的指定端口配置根保护功能

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

interface GE1/0/1
 stp root-protection

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

interface GE1/0/1
 stp root-protection
  1. 配置处于环网中的设备的二层转发功能
  • 在交换设备SwitchA、SwitchB、SwitchC和SwitchD上创建VLAN2~20

# 在SwitchA上创建VLAN2~20。

vlan batch 2 to 20

# 在SwitchB上创建VLAN2~20。

vlan batch 2 to 20

# 在SwitchC上创建VLAN2~20。

vlan batch 2 to 20

# 在SwitchD上创建VLAN2~20。

vlan batch 2 to 20
  • 将交换设备上接入环路中的端口加入VLAN

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

interface GE1/0/1
 port link-type trunk
 port trunk allow-pass vlan 2 to 20

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

interface GE1/0/0
 port link-type trunk
 port trunk allow-pass vlan 2 to 20

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

interface GE1/0/1
 port link-type trunk
 port trunk allow-pass vlan 2 to 20

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

interface GE1/0/0
 port link-type trunk
 port trunk allow-pass vlan 2 to 20

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

interface GE1/0/2
 port link-type access
 port default vlan 2

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

interface GE1/0/0
 port link-type trunk
 port trunk allow-pass vlan 2 to 20

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

interface GE1/0/1
 port link-type trunk
 port trunk allow-pass vlan 2 to 20

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

interface GE1/0/2
 port link-type access
 port default vlan 11

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

interface GE1/0/1
 port link-type trunk
 port trunk allow-pass vlan 2 to 20

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

interface GE1/0/0
 port link-type trunk
 port trunk allow-pass vlan 2 to 20
  1. 验证配置结果

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

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

[~SwitchA]dis stp bri
 MSTID  Port                        Role  STP State     Protection      Cost    
Edged
     0  GE1/0/0                     ROOT  forwarding    none             199    
disable   
     0  GE1/0/1                     DESI  discarding    root             199    
disable   
     1  GE1/0/0                     DESI  forwarding    none             199    
disable   
     1  GE1/0/1                     DESI  forwarding    root             199    
disable   
     2  GE1/0/0                     ROOT  forwarding    none             199    
disable   
     2  GE1/0/1                     DESI  forwarding    root             199    
disable   
[~SwitchA]

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

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

[~SwitchB]dis stp bri
 MSTID  Port                        Role  STP State     Protection      Cost    
Edged
     0  GE1/0/0                     DESI  forwarding    none             199    
disable   
     0  GE1/0/1                     DESI  discarding    root             199    
disable   
     1  GE1/0/0                     ROOT  forwarding    none             199    
disable   
     1  GE1/0/1                     DESI  forwarding    root             199    
disable   
     2  GE1/0/0                     DESI  forwarding    none             199    
disable   
     2  GE1/0/1                     DESI  forwarding    root             199    
disable   
[~SwitchB]

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

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

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

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

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

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

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

 

  • 5
    点赞
  • 24
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值