详解配置交换机多生成树MSTP+VRRP 的典型组网
详解配置交换机多生成树MSTP+VRRP 的典型组网
组网:
1. 这是一个由三台交换机组成的倒三角型二层交换网络;网络中有4个VLAN:10、20、30、40;接口编号如图所示;SW3为接入层交换机,SW1、SW2为汇聚层交换机;
2. VLAN10对应的网段为192.168.10.0/24;VLAN20对应的网段为192.168.20.0/24;VLAN30对应的网段为192.168.30.0/24;VLAN40对应的网段为192.168.40.0/24;各VLAN的网关均为192.168.x.254的地址,该地址为VRRP组的虚拟地址。
现在要求:
1. 由于网络中VLAN较多,并且存在二层环路,因此使用MSTP实现环路避免,同时实现负载分担。要求VLAN10、VLAN20的流量主走SW1-SW3这一侧链路,VLAN30、VLAN40的流量主走SW2-SW3这一侧链路;
2. 为了提高网络的网关层冗余能力,在SW1及SW2的vlanif10、vlanif20、vlanif30、vlanif40上部署VRRP,一共4组。
二、IP设置:
PC1:192.168.10.1/24,vlan10
PC2:192.168.20.1/24,vlan20
PC3:192.168.30.1/24,vlan30
PC4:192.168.40.1/24,vlan40
SW1:
vlanif10:192.168.10.253/24,virtual-ip:192.168.10.254/24,master
Vlanif20:192.168.20.253/24,virtual-ip:192.168.20.254/24,master
Vlanif30:192.168.30.253/24,virtual-ip:192.168.30.254/24,backup
Vlanif40:192.168.40.253/24,virtual-ip:192.168.40.254/24,backup
SW2:
vlanif10:192.168.10.252/24,virtual-ip:192.168.10.254/24,backup
Vlanif20:192.168.20.252/24,virtual-ip:192.168.20.254/24,backup
Vlanif30:192.168.30.252/24,virtual-ip:192.168.30.254/24,master
Vlanif40:192.168.40.252/24,virtual-ip:192.168.40.254/24,master
三、配置步骤:
由于网络中VLAN较多,并且存在二层环路因此使用MSTP实现环路避免,同时实现负载分担。将VLAN10、20映射到MSTP实例1;将VLAN30、40映射到MSTP实例2。MSTP实例1阻塞掉的端口为SW3的GE0/0/22,实例2阻塞掉的端口为SW3的GE0/0/21。换句话说就是SW1配置为实例1的主根、实例2的次根,而SW2配置为实例2的主根、实例1的次根。这个案例中必须确保VRRP的Master及Backup与MSTP的主、备根重叠。也就是说SW1是MSTP实例1的主根,同时它是vlanif10及vlanif20的VRRP Master,而SW2是MSTP实例2的主根,同时它是vlanif30及vlanif40的VRRP Master。
SW3的配置如下:
#在SW3上创建VLAN,并将接口加入相应的VLAN:
[SW3] vlan batch 10 20 30 40
[SW3] interface GigabitEthernet0/0/21
[SW3-GigabitEthernet0/0/21] port link-type trunk
[SW3-GigabitEthernet0/0/21] port trunk allow-pass vlan 10 20 30 40
[SW3] interface GigabitEthernet0/0/22
[SW3-GigabitEthernet0/0/22] port link-type trunk
[SW3-GigabitEthernet0/0/22] port trunk allow-pass vlan 10 20 30 40
#配置MSTP,将vlan10 20映射到实例1,将vlan30 40映射到实例2。在SW3上,MSTP实例1及实例2的优先级保持默认32768:
[SW3] stp mode mstp
[SW3] stp region-configuration
[SW3-mst-region] region-name huawei
#配置MSTP域名
[SW3-mst-region] instance 1 vlan 10 20
#将VLAN10、20映射到实例1
[SW3-mst-region] instance 2 vlan 30 40
#将VLAN30、40映射到实例2
[SW3-mst-region] active region-configuration #激活配置
[SW3-mst-region] quit
[SW3] stp enable
SW1的配置如下:
[SW1] vlan batch 10 20 30 40
[SW1] interface GigabitEthernet0/0/24
[SW1-GigabitEthernet0/0/24] port link-type trunk
[SW1-GigabitEthernet0/0/24] port trunk allow-pass vlan 10 20 30 40
[SW1] interface GigabitEthernet0/0/21
[SW1-GigabitEthernet0/0/21] port link-type trunk
[SW1-GigabitEthernet0/0/21] port trunk allow-pass vlan 10 20 30 40
#配置MSTP,将VLAN10 20映射到实例1,将VLAN30 40映射到实例2。将SW1的MSTP设置为实例1的主根,实例2的次根:
[SW1] stp mode mstp
[SW1] stp region-configuration
[SW1-mst-region] region-name huawei
[SW1-mst-region] instance 1 vlan 10 20
[SW1-mst-region] instance 2 vlan 30 40
[SW1-mst-region] active region-configuration
[SW1-mst-region] quit
[SW1] stp instance 1 root primary
[SW1] stp instance 2 root secondary
[SW1] stp enable
#配置vlanif10、vlanif20、vlanif30、vlanif40,分别加入VRRP组10,20,30,40。其中SW1为VRRP组10及20的Master,为组30及40的Backup:
[SW1] interface Vlanif 10
[SW1-vlanif10] ip address 192.168.10.253 255.255.255.0
[SW1-vlanif10] vrrp vrid 10 virtual-ip 192.168.10.254
[SW1-vlanif10] vrrp vrid 10 priority 120
[SW1] interface Vlanif 20
[SW1-vlanif20] ip address 192.168.20.253 255.255.255.0
[SW1-vlanif20] vrrp vrid 20 virtual-ip 192.168.20.254
[SW1-vlanif20] vrrp vrid 20 priority 120
[SW1] interface Vlanif 30
[SW1-vlanif30] ip address 192.168.30.253 255.255.255.0
[SW1-vlanif30] vrrp vrid 30 virtual-ip 192.168.30.254
[SW1] interface Vlanif 40
[SW1-vlanif40] ip address 192.168.40.253 255.255.255.0
[SW1-vlanif40] vrrp vrid 40 virtual-ip 192.168.40.254
SW2的配置如下:
[SW2] vlan batch 10 20 30 40
[SW2] interface GigabitEthernet0/0/24
[SW2-GigabitEthernet0/0/24] port link-type trunk
[SW2-GigabitEthernet0/0/24] port trunk allow-pass vlan 10 20 30 40
[SW2] interface GigabitEthernet0/0/22
[SW2-GigabitEthernet0/0/22] port link-type trunk
[SW2-GigabitEthernet0/0/22] port trunk allow-pass vlan 10 20 30 40
#配置MSTP,将VLAN10 20映射到实例1,将VLAN30 40映射到实例2。将SW2的MSTP设置为实例2的主根,实例1的次根:
[SW2] stp mode mstp
[SW2] stp region-configuration
[SW2-mst-region] region-name huawei
[SW2-mst-region] instance 1 vlan 10 20
[SW2-mst-region] instance 2 vlan 30 40
[SW2-mst-region] active region-configuration
[SW2-mst-region] quit
[SW2] stp instance 1 root secondary
[SW2] stp instance 2 root primary
[SW2] stp enable
#配置vlanif10、vlanif20、vlanif30、vlanif40,分别加入VRRP组10,20,30,40。其中SW1为VRRP组30及40的Master,为组10及20的Backup
[SW2] interface Vlanif 10
[SW2-vlanif10] ip address 192.168.10.252 255.255.255.0
[SW2-vlanif10] vrrp vrid 10 virtual-ip 192.168.10.254
[SW2] interface Vlanif 20
[SW2-vlanif20] ip address 192.168.20.252 255.255.255.0
[SW2-vlanif20] vrrp vrid 20 virtual-ip 192.168.20.254
[SW2] interface Vlanif 30
[SW2-vlanif30] ip address 192.168.30.252 255.255.255.0
[SW2-vlanif30] vrrp vrid 30 virtual-ip 192.168.30.254
[SW2-vlanif30] vrrp vrid 30 priority 120
[SW2] interface Vlanif 40
[SW2-vlanif40] ip address 192.168.40.252 255.255.255.0
[SW2-vlanif40] vrrp vrid 40 virtual-ip 192.168.40.254
[SW2-vlanif40] vrrp vrid 40 priority 120
完成配置后,各VLAN的用户都能够ping通自己的网关,在SW3上看看:
<SW3>dis stp bri
MSTID Port Role STP State Protection
0 GigabitEthernet0/0/1 DESI FORWARDING NONE
0 GigabitEthernet0/0/2 DESI FORWARDING NONE
0 GigabitEthernet0/0/3 DESI LEARNING NONE
0 GigabitEthernet0/0/4 DESI LEARNING NONE
0 GigabitEthernet0/0/21 DESI FORWARDING NONE
0 GigabitEthernet0/0/22 ROOT FORWARDING NONE
1 GigabitEthernet0/0/1 DESI FORWARDING NONE
1 GigabitEthernet0/0/2 DESI FORWARDING NONE
1 GigabitEthernet0/0/21 ROOT FORWARDING NONE
1 GigabitEthernet0/0/22 ALTE DISCARDING NONE
2 GigabitEthernet0/0/3 DESI LEARNING NONE
2 GigabitEthernet0/0/4 DESI LEARNING NONE
2 GigabitEthernet0/0/21 ALTE DISCARDING NONE
2 GigabitEthernet0/0/22 ROOT FORWARDING NONE
在SW3上我们看到,MSTP实例1中被Block掉的端口是GE0/0/22口;MSTP实例2中被Block掉的端口是GE0/0/21,符合需求。再去SW1上看看VRRP组的状态:
<SW1>display vrrp bri
VRID State Interface Type Virtual IP
----------------------------------------------------------------
10 Master Vlanif10 Normal 192.168.10.254
20 Master Vlanif20 Normal 192.168.20.254
30 Backup Vlanif30 Normal 192.168.30.254
40 Backup Vlanif40 Normal 192.168.40.254
----------------------------------------------------------------
Total:4 Master:2 Backup:2 Non-active:0
从上述输出可以看出,SW1为VRRP组10及组20的Master,同时也为VRRP组30和组40的Backup。
<SW2>display vrrp bri
VRID State Interface Type Virtual IP
----------------------------------------------------------------
10 Backup Vlanif10 Normal 192.168.10.254
20 Backup Vlanif20 Normal 192.168.20.254
30 Master Vlanif30 Normal 192.168.30.254
40 Master Vlanif40 Normal 192.168.40.254
----------------------------------------------------------------
Total:4 Master:2 Backup:2 Non-active:0
而SW2则正好相反。如此一来,VLAN10及VLAN20用户访问外网的流量将SW3-SW1的路径转发,VLAN30及VLAN40用户访问外网的流量将SW2-SW1的路径转发。当网络中的链路发生故障时,将会启用另一条备份链路,业务不受影响。
四、SW3的主要配置文件:
#
sysname SW3
#
vlan batch 10 20 30 40
#
stp region-configuration
region-name huawei
instance 1 vlan 10 20
instance 2 vlan 30 40
active region-configuration
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 10
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 20
#
interface GigabitEthernet0/0/3
port link-type access
port default vlan 30
#
interface GigabitEthernet0/0/4
port link-type access
port default vlan 40
#
interface GigabitEthernet0/0/21
port link-type trunk
port trunk allow-pass vlan 10 20 30 40
#
interface GigabitEthernet0/0/22
port link-type trunk
port trunk allow-pass vlan 10 20 30 40
#
return
五、SW1的主要配置文件:
<SW1>disp cu
#
sysname SW1
#
vlan batch 10 20 30 40
#
stp instance 1 root primary
stp instance 2 root secondary
#
stp region-configuration
region-name huawei
instance 1 vlan 10 20
instance 2 vlan 30 40
active region-configuration
#
interface Vlanif10
ip address 192.168.10.253 255.255.255.0
vrrp vrid 10 virtual-ip 192.168.10.254
vrrp vrid 10 priority 120
#
interface Vlanif20
ip address 192.168.20.253 255.255.255.0
vrrp vrid 20 virtual-ip 192.168.20.254
vrrp vrid 20 priority 120
#
interface Vlanif30
ip address 192.168.30.253 255.255.255.0
vrrp vrid 30 virtual-ip 192.168.30.254
#
interface Vlanif40
ip address 192.168.40.253 255.255.255.0
vrrp vrid 40 virtual-ip 192.168.40.254
#
interface MEth0/0/1
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20 30 40
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 10 20 30 40
#
return
六、SW2的主要配置文件:
#
sysname SW2
#
vlan batch 10 20 30 40
#
stp instance 1 root secondary
stp instance 2 root primary
#
stp region-configuration
region-name huawei
instance 1 vlan 10 20
instance 2 vlan 30 40
active region-configuration
#
interface Vlanif10
ip address 192.168.10.252 255.255.255.0
vrrp vrid 10 virtual-ip 192.168.10.254
#
interface Vlanif20
ip address 192.168.20.252 255.255.255.0
vrrp vrid 20 virtual-ip 192.168.20.254
#
interface Vlanif30
ip address 192.168.30.252 255.255.255.0
vrrp vrid 30 virtual-ip 192.168.30.254
vrrp vrid 30 priority 120
#
interface Vlanif40
ip address 192.168.40.252 255.255.255.0
vrrp vrid 40 virtual-ip 192.168.40.254
vrrp vrid 40 priority 120
#
interface MEth0/0/1
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20 30 40
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 10 20 30 40
#
return
相关文章:

详解配置交换机多生成树MSTP+VRRP 的典型组网
详解配置交换机多生成树MSTPVRRP 的典型组网 组网: 1. 这是一个由三台交换机组成的倒三角型二层交换网络;网络中有4个VLAN:10、20、30、40;接口编号如图所示;SW3为接入层交换机,SW1、SW2为汇聚层交换机&am…...

二.net core 自动化发布到docker (Jenkins安装之后向导)
目录 参考资料:https://www.jenkins.io/doc/book/installing/docker/#setup-wizard Post-installation setup wizard.(安装后安装向导) 基于上一篇文章安装,在安装并运行Jenkins(不包括使用Jenkins Opera…...

【设计模式——学习笔记】23种设计模式——解释器模式Interpreter(原理讲解+应用场景介绍+案例介绍+Java代码实现)
案例引入 通过解释器模式来实现四则运算,如计算ab-c的值,具体要求 先输入表达式的形式,比如abc-de,要求表达式的字母不能重复在分别输入a,b,c,d,e的值最后求出结果 传统方案 编写一个方法,接收表达式的形式…...

【计算机网络】——数据链路层
二、组帧 1、字符计数法 帧头部使用一个字符来表示帧的大小(包括第一个计数字符) (此处一字符一个字节) 2、字符填充收尾定界法 特定字符来定界帧的首和尾。若帧中数据段出现等同于特定字符的字符内容,前置一个转义字符。(类似于正则表达…...

数据结构:栈和队列(超详细)
目录 编辑 栈: 栈的概念及结构: 栈的实现: 队列: 队列的概念及结构: 队列的实现: 扩展知识: 以上就是个人学习线性表的个人见解和学习的解析,欢迎各位大佬在评论区探讨&#…...

AI项目二:基于mediapipe的虚拟鼠标控制
若该文为原创文章,转载请注明原文出处。 一、项目介绍 由于博主太懒,mediapipe如何实现鼠标控制的原理直接忽略,最初的想法是想控制摄像头识别手指控制鼠标,达到播放电影的效果。基本上效果也是可以的。简单的说是使用mediapipe检…...

EVE-NG 隐藏没有镜像的模板
eve-ng 默认情况下,在添加node时,会列出所有的模板,这样用着很不方便。 通过以下方式,可以使没有设备的模板不可见 cp /opt/unetlab/html/includes/config.php.distribution /opt/unetlab/html/includes/config.php 打开 config…...

机器学习理论笔记(一):初识机器学习
文章目录 1 前言:蓝色是天的机器学习笔记专栏1.1 专栏初衷与定位1.2 本文主要内容 2 机器学习的定义2.1 机器学习的本质2.2 机器学习的分类 3 机器学习的基本术语4 探索"没有免费的午餐"定理(NFL)5 结语 1 前言:蓝色是天…...
Programming abstractions in C阅读笔记: p114-p117
《Programming Abstractions in C》学习第48天,p114-p117,总结如下: 一、技术总结 主要通过random number介绍了随机数的相关用法,interface示例(random.h),client program示例(craps.c)。 #include <stdio…...

分布式应用:Zabbix监控Tomcat
目录 一、理论 1.Zabbix监控Tomcat 二、实验 1.Zabbix监控Tomcat 三、问题 1.获取软件包失败 2.tomcat 配置 JMX remote monitor不生效 3.Zabbix客户端日志报错 一、理论 1.Zabbix监控Tomcat (1)环境 zabbix服务端:192.168.204.214 …...

《起风了》C++源代码
使用方法 Visual Studio、Dev-C、Visual Studio Code等C/C创建一个 .cpp 文件,直接粘贴赋值即可。 #include <iostream> #include <Windows.h> #pragma comment(lib,"winmm.lib") using namespace std; enum Scale {Rest 0, C8 108, B7 …...

Grafana展示k8s中pod的jvm监控面板/actuator/prometheus
场景 为保障java服务正常运行,对服务的jvm进行监控,通过使用actuator组件监控jvm情况,使用prometheus对数据进行采集,并在Grafana展现。 基于k8s场景 prometheus数据收集 配置service的lable,便于prometheus使用labl…...

实例038 设置窗体在屏幕中的位置
实例说明 在窗体中可以设置窗体居中显示,本例通过设置窗体的Left属性和Top属性可以准确设置窗体的位置。运行本例,效果如图1.38所示。 技术要点 设置窗体在屏幕中的位置,可以通过设置窗体的属性来实现。窗体的Left属性表示窗体距屏幕左侧的…...

合成数据及其在AI领域中的作用
什么是合成数据? 合成数据是由人工创建而非从现实生活中获得的数据,它从机器学习对数据的需求发展而来。最初,为了精确训练AI模型,必须获得涵盖所有可能场景的训练数据。如果某个场景没有发生或未被获得,就没有相应的…...

Java内存区域(运行时数据区域)和内存模型(JMM)
Java 内存区域和内存模型是不一样的东西,内存区域是指 Jvm 运行时将数据分区域存储,强调对内存空间的划分。 而内存模型(Java Memory Model,简称 JMM )是定义了线程和主内存之间的抽象关系,即 JMM 定义了 …...
【HDFS】hdfs的count命令的参数详解
Usage: hadoop fs -count [-q] [-h] [-v] [-x] [-t [<storage type>]] [-u] [-e] [-s] <paths...
Lombok注解在JSON化中,JSON生成额外生成字段问题
问题描述: 定义如下对象 Dataclass A{private String A;public String getC() {return "abab";}} 执行如下逻辑 Autowiredprivate ObjectMapper objectMapper;Testpublic void test4() throws Exception {A a new A();a.setA("a");System.ou…...

docker中的jenkins之流水线构建
docker中的jenkins之流水线构建项目 1、用node这种方式(因为我用pipeline方式一直不执行,不知道为什么) 2、创建项目 创建两个参数,一个是宿主端口号,一个是docker中的端口号 3、使用git项目中的Jenkinsfile 4、编写…...

ES中倒排索引机制
在ES的倒排索引机制中有四个重要的名词:Term、Term Dictionary、Term Index、Posting List。 Term(词条):词条是索引里面最小的存储和查询单元。一段文本经过分析器分析以后就会输出一串词条。一般来说英文语境中词条是一个单词&a…...

一生一芯4——使用星火应用商店在ubuntu下载QQ、微信、百度网盘
星火应用商店可以非常方便的完成一些应用的下载,下面是官方网址 http://spark-app.store/download 我使用的是intel处理器,无需下载依赖项,直接点击软件本体 我这里下载amd64,根据自己的处理器下载对应版本 sudo apt install ./spark-stor…...
React Native 导航系统实战(React Navigation)
导航系统实战(React Navigation) React Navigation 是 React Native 应用中最常用的导航库之一,它提供了多种导航模式,如堆栈导航(Stack Navigator)、标签导航(Tab Navigator)和抽屉…...

智慧工地云平台源码,基于微服务架构+Java+Spring Cloud +UniApp +MySql
智慧工地管理云平台系统,智慧工地全套源码,java版智慧工地源码,支持PC端、大屏端、移动端。 智慧工地聚焦建筑行业的市场需求,提供“平台网络终端”的整体解决方案,提供劳务管理、视频管理、智能监测、绿色施工、安全管…...

如何在看板中体现优先级变化
在看板中有效体现优先级变化的关键措施包括:采用颜色或标签标识优先级、设置任务排序规则、使用独立的优先级列或泳道、结合自动化规则同步优先级变化、建立定期的优先级审查流程。其中,设置任务排序规则尤其重要,因为它让看板视觉上直观地体…...

关于nvm与node.js
1 安装nvm 安装过程中手动修改 nvm的安装路径, 以及修改 通过nvm安装node后正在使用的node的存放目录【这句话可能难以理解,但接着往下看你就了然了】 2 修改nvm中settings.txt文件配置 nvm安装成功后,通常在该文件中会出现以下配置&…...

【大模型RAG】Docker 一键部署 Milvus 完整攻略
本文概要 Milvus 2.5 Stand-alone 版可通过 Docker 在几分钟内完成安装;只需暴露 19530(gRPC)与 9091(HTTP/WebUI)两个端口,即可让本地电脑通过 PyMilvus 或浏览器访问远程 Linux 服务器上的 Milvus。下面…...

视频字幕质量评估的大规模细粒度基准
大家读完觉得有帮助记得关注和点赞!!! 摘要 视频字幕在文本到视频生成任务中起着至关重要的作用,因为它们的质量直接影响所生成视频的语义连贯性和视觉保真度。尽管大型视觉-语言模型(VLMs)在字幕生成方面…...

uniapp微信小程序视频实时流+pc端预览方案
方案类型技术实现是否免费优点缺点适用场景延迟范围开发复杂度WebSocket图片帧定时拍照Base64传输✅ 完全免费无需服务器 纯前端实现高延迟高流量 帧率极低个人demo测试 超低频监控500ms-2s⭐⭐RTMP推流TRTC/即构SDK推流❌ 付费方案 (部分有免费额度&#x…...
MySQL中【正则表达式】用法
MySQL 中正则表达式通过 REGEXP 或 RLIKE 操作符实现(两者等价),用于在 WHERE 子句中进行复杂的字符串模式匹配。以下是核心用法和示例: 一、基础语法 SELECT column_name FROM table_name WHERE column_name REGEXP pattern; …...

IoT/HCIP实验-3/LiteOS操作系统内核实验(任务、内存、信号量、CMSIS..)
文章目录 概述HelloWorld 工程C/C配置编译器主配置Makefile脚本烧录器主配置运行结果程序调用栈 任务管理实验实验结果osal 系统适配层osal_task_create 其他实验实验源码内存管理实验互斥锁实验信号量实验 CMISIS接口实验还是得JlINKCMSIS 简介LiteOS->CMSIS任务间消息交互…...
LangChain知识库管理后端接口:数据库操作详解—— 构建本地知识库系统的基础《二》
这段 Python 代码是一个完整的 知识库数据库操作模块,用于对本地知识库系统中的知识库进行增删改查(CRUD)操作。它基于 SQLAlchemy ORM 框架 和一个自定义的装饰器 with_session 实现数据库会话管理。 📘 一、整体功能概述 该模块…...