详解配置交换机多生成树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…...

编程练习(1)
目录 一.选择题 第一题: 第二题: 第三题: 第四题: 第五题: 编辑 二.编程题 第一题: 第二题: 1.暴力方法: 2.数组法: 一.选择题 第一题: 解析&…...

pytorch安装VAE项目详解
安装VAE项目 一、 基本环境二、代码来源三、搭建conda环境四、下载数据集五、启动项目六、其他相关问题 一、 基本环境 工具版本号OSwin 11pycharm2020.1GPU3050 二、代码来源 github地址为: https://github.com/AntixK/PyTorch-VAE/blob/8700d245a9735640dda458d…...

SQL-每日一题【1517. 查找拥有有效邮箱的用户】
题目 表: Users 编写一个解决方案,以查找具有有效电子邮件的用户。 一个有效的电子邮件具有前缀名称和域,其中: 前缀 名称是一个字符串,可以包含字母(大写或小写),数字,下划线 _ &…...

Python web实战之Django 的 WebSocket 支持详解
关键词:Python, Django, WebSocket, Web 如何使用 Django 实现 WebSocket 功能?本文将详细介绍 WebSocket 的概念、Django 的 WebSocket 支持以及如何利用它来创建动态、响应式的 Web 应用。 1. WebSocket 简介 1.1 什么是 WebSocket? 在 W…...

CDN(内容分发网络)
CDN的全称是 Content Delivery Network, 即内容分发网络。CDN是构建在现有网络基础之上的智能虚拟网络,依靠部署在各地的边缘服务器,通过中心平台的负载均衡、内容分发、调度等功能模块,使用户就近获取所需内容,降低网络拥塞&a…...

前端高频面试题 Day01
文章目录 1. Map 和 Object 的不同API 不同以任意类型为 keyMap 是有序结构Map 很快WeakMap总结 2. Set 和数组的区别Set 元素不能重复API 不一样Set 是无序的,而数组是有序的 —— 这一点很少有人提到,却很关键!!!Wea…...

『C语言初阶』第八章 -隐式类型转换规则
前言 今天小羊又来给铁汁们分享关于C语言的隐式类型转换规则,在C语言中类型转换方式可分为隐式类型转换和显式类型转换(强制类型转换),其中隐式类型转换是由编译器自动进行,无需程序员干预,今天小羊课堂说的就是关于隐式类型转换…...

Fortinet数据中心防火墙及服务ROI超300%!Forrester TEI研究发布
近日,专注网络与安全融合的全球网络安全领导者 Fortinet(NASDAQ:FTNT)联合全球知名分析机构Forrester发布总体经济影响独立分析报告,详细阐述了在企业数据中心部署 FortiGate 下一代防火墙(NGFW)…...

【vue】简洁优雅的火花线、趋势线
来由 在github发现个好看易用的vue趋势线组件,特此记录。 效果 趋势图生成后效果如上,线条为渐变色,可设置是否平滑。具体线条走势,根据数据动态生成。 使用 安装 npm i vuetrend -S 引入 import Vue from "vue"…...

【软件工程】数据流图/DFD概念符号/流程图分层/数据字典
【软件工程】数据流图/DFD概念符号/流程图分层/数据字典 目录 【软件工程】数据流图/DFD概念符号/流程图分层/数据字典 一、数据流图 ( DFD ) 简介 二、数据流图 ( DFD ) 概念符号 1、数据流 2、加工 ( 核心 ) 3、数据存储 4、外部实体 三、数据流图 ( DFD ) 分层 1、…...