【华为网络-配置-021】- MSTP 多实例配置及安全保护等

要求:

1、vlan 10 从红色链路转发。
2、vlan 20 从黄色链路转发。

一、基础配置

b 复制代码
[SW1]vlan batch 10 20
[SW1]interface GigabitEthernet 0/0/1
[SW1-GigabitEthernet0/0/1]port link-type trunk
[SW1-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[SW1-GigabitEthernet0/0/1]quit
[SW1]interface GigabitEthernet 0/0/2
[SW1-GigabitEthernet0/0/2]port trunk allow-pass vlan all
[SW1-GigabitEthernet0/0/2]quit

[SW2]vlan batch 10 20
[SW2]interface GigabitEthernet 0/0/1
[SW2-GigabitEthernet0/0/1]port link-type trunk
[SW2-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[SW2-GigabitEthernet0/0/1]quit
[SW2]interface GigabitEthernet 0/0/2
[SW2-GigabitEthernet0/0/2]port trunk allow-pass vlan all

[SW3]vlan batch 10 20
[SW3]interface GigabitEthernet 0/0/1
[SW3-GigabitEthernet0/0/1]port link-type trunk
[SW3-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[SW3-GigabitEthernet0/0/1]quit
[SW3]interface GigabitEthernet 0/0/2
[SW3-GigabitEthernet0/0/2]port trunk allow-pass vlan all

二、多实例配置

b 复制代码
开启 STP 服务。设置 STP 服务为 MSTP。
[SW1]stp enable
[SW1]stp mode mstp

进入 STP 配置视图。
[SW1]stp region-configuration

创建名为 msgroup01 的组名称(名称可自定义,但需要保证所有加入的节点名称一致)。
[SW1-mst-region]region-name msgroup01

创建实例 1 并允许通过的 vlan 号为 10 至 19 。
[SW1-mst-region]instance 1 vlan 10 to 19

创建实例 2 并允许通过的 vlan 号为20 至 29。
[SW1-mst-region]instance 2 vlan 20 to 29

激活 STP 配置。
[SW1-mst-region]active region-configuration 

在其他加入的节点中,使用一模一样的配置(跟 SW1 一样)。
[SW2]stp enable
[SW2]stp mode mstp
[SW2]stp region-configuration
[SW2-mst-region]region-name msgroup01
[SW2-mst-region]instance 1 vlan 10 to 19
[SW2-mst-region]instance 2 vlan 20 to 29
[SW2-mst-region]active region-configuration 

[SW3]stp enable
[SW3]stp mode mstp
[SW3]stp region-configuration
[SW3-mst-region]region-name msgroup01
[SW3-mst-region]instance 1 vlan 10 to 19
[SW3-mst-region]instance 2 vlan 20 to 29
[SW3-mst-region]active region-configuration

设置实例优先级。
配置 SW2 的实例 1 优先级高(实例 1 包含 vlan 10)。
(4096 是因为原交换机默认优先级是 32768 ,实际项目中需要先看默认优先级,再调整这里的优先级大小)。
[SW2]stp instance 1 priority 4096
[SW2]stp instance 2 priority 8192

配置 SW3 的实例 2 优先级高(实例 2 包含 vlan 20)。
[SW3]stp instance 1 priority 8192
[SW3]stp instance 2 priority 4096

三、扩展配置

3.1 配置接口为边缘端口

b 复制代码
一般用于连接终端的交换机接口,可以避免终端因频繁上下线导致的网络震荡。

全局配置(配置当前设备上所有端口为边缘端口,一般不这样设置)
[SW1]stp edged-port default

接口配置(开启)(也可以更改 enable 参数,使用 disable 关闭此边缘端口)
[SW1]interface GigabitEthernet 0/0/1
[SW1-GigabitEthernet0/0/1]stp edged-port enable

3.2 开启 BPDU 保护

b 复制代码
防止环路和避免协议攻击(配合边缘端口使用)。(如果在某个接口收到自己发出的 BPDU 报文,那就将此接口关闭)。
[SW1]stp bpdu-protection

设置因为 BPDU 保护关闭的接口重新恢复的间隔时间(秒)(60 可更改)。
[SW1]error-down auto-recovery cause bpdu-protection interval 60

3.3 根保护(DP接口下设置)

b 复制代码
避免由于错误配置或恶意攻击导致的 STP 根桥地位丢失(跟环路保护功能冲突)。
[SW2]interface GigabitEthernet 0/0/1
[SW2-GigabitEthernet0/0/1]stp root-protection

3.4 配置泛洪保护(全局,默认是 1 )

b 复制代码
一段时间内,处理 BPDU 的数量。
[SW1]stp tc-protection threshold 5

3.5 关闭接受 BPDU 报文(接口收到后丢弃,但不影响发送)

b 复制代码
[SW1]interface GigabitEthernet 0/01
[SW1-GigabitEthernet0/0/1]bpdu disable

3.6 接口关闭 STP(接口不发送 BPDU 报文)

b 复制代码
[SW1]interface GigabitEthernet 0/01
[SW1-GigabitEthernet0/0/1]stp disable

3.7 接口关闭 STP 透传 BPDU 报文

b 复制代码
CE交换机
[SW1]interface GigabitEthernet 0/01
[SW1-GigabitEthernet0/0/1]bpdu bridge enable

S系列交换机
[SW1]interface GigabitEthernet 0/01
[SW1-GigabitEthernet0/0/1]stp disable
[SW1-GigabitEthernet0/0/1]l2protocol-tunnel stp enable
相关推荐
qizayaoshuap1 小时前
# [特殊字符] 宠物模拟器 — 鸿蒙ArkTS完整技术解析(最终篇)
华为·harmonyos·宠物
不言鹅喻1 小时前
HarmonyOS ArkTS 实战:实现一个校园自动售货机库存与补货记录应用
华为·harmonyos
JoyCong19981 小时前
打破远程协助的安全信任困局,ToDesk AI审计功能自动操作留痕
网络·人工智能·科技·安全·电脑·远程工作
Mr.HeBoYan3 小时前
一次持续三天才出现的丢包故障——深入解析 DPDK Memory Ordering、rte_ring 与 CPU Memory Barrier (下)
linux·网络·算法·架构·dpdk
不肥嘟嘟右卫门5 小时前
鸿蒙原生ArkTS布局方式之LazyForEach懒加载布局深度解析
华为·harmonyos
xd1855785556 小时前
道歉话术生成:基于鸿蒙生态的智能情感沟通助手
人工智能·华为·harmonyos·鸿蒙
yunwei376 小时前
实证研究:AI Agent 规则需要上下文与分层强制执行
linux·安全·ai编程
kp000007 小时前
System Prompt Leakage(系统提示词泄露)及安全防御
网络·安全·网络安全·信息安全·prompt·ai安全
许彰午7 小时前
02-网络的抽象层
网络·智能路由器
ttod_qzstudio7 小时前
【软考备考】计算机网络详解:OSI/TCP-IP 分层 + IP 子网划分,一篇拿下网络模块(附 10 道练习)
网络·tcp/ip·计算机网络·软考