【eNSP实战】交换机配置MSTP

拓扑图
在这里插入图片描述

  1. LSW1配置为vlan10的根交换机;LSW2配置为vlan20的根交换机
  2. PC主机配置如图所示,这里不展示
  3. 本次核心是配置MSTP多生成树协议

LSW1配置vlan

vlan batch 10 20
#
interface GigabitEthernet0/0/1
 port link-type trunk
 port trunk allow-pass vlan 10 20
#
interface GigabitEthernet0/0/2
 port link-type trunk
 port trunk allow-pass vlan 10 20

LSW2配置vlan

vlan batch 10 20
#
interface GigabitEthernet0/0/1
 port link-type trunk
 port trunk allow-pass vlan 10 20
#
interface GigabitEthernet0/0/2
 port link-type trunk
 port trunk allow-pass vlan 10 20

LSW3配置vlan

vlan batch 10 20
#
interface Ethernet0/0/1
 port link-type access
 port default vlan 10
#
interface Ethernet0/0/2
 port link-type access
 port default vlan 20
#
interface GigabitEthernet0/0/1
 port link-type trunk
 port trunk allow-pass vlan 10 20
#
interface GigabitEthernet0/0/2
 port link-type trunk
 port trunk allow-pass vlan 10 20

下面开始配置MSTP
LSW1配置MSTP,设置该交换机为vlan10的根交换机、vlan20的备根交换机

[LSW1]stp mode mstp		# 设置交换机stp模式为MSTP
[LSW1]stp region-configuration		# 进入MSTP区域配置模式
[LSW1-mst-region]region-name re-mstp	# 配置域名为rs-mstp(名字随便)
[LSW1-mst-region]revision-level 1		# 配置版本级别为1
[LSW1-mst-region]instance 1 vlan 10		# 将vlan10加入实例1中
[LSW1-mst-region]instance 2 vlan 20		# 将vlan20加入实例2中
[LSW1-mst-region]active region-configuration		# 激活配置(必须激活)
[LSW1-mst-region]quit
[LSW1]stp instance 1 root primary 		# 配置此交换机为实例1的根交换机
[LSW1]stp instance 2 root secondary 	# 配置此交换机为实例2的备根交换机

LSW2配置MSTP,设置该交换机为vlan20的根交换机、vlan10的备根交换机

[LSW2]stp mode mstp
[LSW2]stp region-configuration 
[LSW2-mst-region]region-name re-mstp	
[LSW2-mst-region]revision-level 1
[LSW2-mst-region]instance 1 vlan 10
[LSW2-mst-region]instance 2 vlan 20
[LSW2-mst-region]active region-configuration 
[LSW2-mst-region]quit	
[LSW2]stp instance 1 root secondary 	# 设置此交换机为实例1的备根交换机
[LSW2]stp instance 2 root primary 		# 设置此交换机为实例2的根交换机

LSW3配置MSTP,此交换机必须要设置根或备根

[LSW3]stp mode mstp
[LSW3]stp region-configuration 
[LSW3-mst-region]region-name re-mstp	
[LSW3-mst-region]revision-level 1
[LSW3-mst-region]instance 1 vlan 10
[LSW3-mst-region]instance 2 vlan 20
[LSW3-mst-region]active region-configuration
[LSW3-mst-region]quit

至此多生成树协议MSTP配置完成,下面在LSW3上查看实例详情信息
在这里插入图片描述

### ENSPMSTP的入门配置 多生成树协议(Multiple Spanning Tree Protocol, MSTP)是一种增强型的生成树协议,能够在单个物理网络上支持多个生成树实例。通过合理规划VLAN映射关系,可以提高带宽利用率并优化流量管理。 以下是关于ENSPMSTP的入门配置相关内容: #### 1. 启用MSTP功能 在华为交换机中启用MSTP功能可以通过以下命令完成: ```shell [Switch] stp mode mst ``` 此命令会将交换机的生成树模式切换至MSTP模式[^1]。 #### 2. 配置MST域参数 为了使一组交换机能够协同工作在一个MST域内,需统一配置域名、修订级别和VLAN-to-MSTI映射表。 - **设置域名** ```shell [Switch-mst-process] domain-name example-domain ``` - **设置修订级别** ```shell [Switch-mst-process] revision-level 1 ``` 这些参数必须在整个MST域内的所有交换机保持一致,否则无法形成同一个MST域[^3]。 #### 3. VLAN到MST Instance的映射 定义哪些VLAN属于哪一个MST实例(Instance),从而实现不同VLAN之间的独立转发路径。 ```shell [Switch-mst-process] instance 1 vlan 10 to 20 [Switch-mst-process] instance 2 vlan 30 to 40 ``` 上述命令表示将VLAN 10 至 20 映射到MST Instance 1,而VLAN 30 至 40 则被分配给MST Instance 2。 #### 4. 调整优先级与端口成本 为了让某些特定交换机成为根桥或者影响指定端口的选择过程,可调整其优先级或手动设定端口的成本值。 - 修改交换机优先级 ```shell [Switch] stp priority 4096 ``` - 自定义端口路径开销 ```shell [Switch-GigabitEthernet0/0/1] stp cost 2000 ``` 较低数值意味着更高的优先权,因此可以根据实际需求灵活调节。 #### 5. 查看当前状态及相关信息 执行如下指令来验证配置效果以及获取详细的运行状况数据。 ```shell [Switch] display stp brief [Switch] display stp mst-instance ``` 以上两条语句分别用于展示整个系统的概览视图和具体某个MST实例的状态详情[^2]。 --- ###
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值