当前位置: 首页 > news >正文

中小型传统企业常用的组网方案你能设计出来吗?一文教你搞懂MSTP+VRRP的架构和配置

一、实验需求

  1. 划分IP地址并配置

  2. 划分vlan并实现vlan间互联互通,配置链路聚合增大链路带宽

  3. 运行OSPF实现PC1访问5.5.5.5(外网)

  4. 配置VRRP和MSTP

二、实验调试

实验拓扑如图3-14所示

图3-14VRRP+MSTP项目拓扑图

三、实验步骤

(1)划分并配置IP地址

1) R1的配置:

system-view[Huawei]undo info-center enable[R1]sysname R1[R1]interface g0/0/1[R1-GigabitEthernet0/0/1]ip address 10.10.10.1 30[R1-GigabitEthernet0/0/1]quit[R1]interfaceg0/0/2[R1-GigabitEthernet0/0/2]ip address 10.10.20.1 30[R1-GigabitEthernet0/0/2]quit[R1]interface LoopBack 0[R1-LoopBack0]ip address 5.5.5.5 24[R1-LoopBack0]quit

2)SW3的配置:

system-view[Huawei]undo info-center enable[Huawei]sysname sw3
[sw3]vlan batch10 20 30[sw3]interface Vlanif1[sw3-Vlanif1]ip address 10.10.10.2 255.255.255.252[sw3]interface Vlanif10[sw3-Vlanif10]ip address 192.168.1.253 255.255.255.0[sw3]interface Vlanif30[sw3-Vlanif30]ip address 10.10.30.1 255.255.255.252

3)SW4的配置:

system-view[Huawei]undo info-center enable[Huawei]sysname sw4[sw4]vlan batch 10 20 30[sw4]interface Vlanif 20[sw4-Vlanif20]ip address 192.168.2.253 24[sw4-Vlanif20]quit[sw4]interface Vlanif 30[sw4-Vlanif30]ip address 10.10.30.2 30[sw4-Vlanif30]quit[sw4]interfaceVlanif 1[sw4-Vlanif1]ip address 10.10.20.2 30[sw4-Vlanif1]quit

(2)划分vlan和配置链路聚合

1)在SW1上创建vlan,将接口G0/0/1划入vlan10,G0/0/2与G0/0/3中间链路类型设置为trunk

system-view[Huawei]undo info-center enable[Huawei]sysname sw1[sw1]vlan batch 10 20 30[sw1]interface g0/0/1[sw1-GigabitEthernet0/0/1]port link-type access[sw1-GigabitEthernet0/0/1]port default vlan 10[sw1-GigabitEthernet0/0/1]quit[sw1]interface g0/0/2[sw1-GigabitEthernet0/0/2]port link-type trunk[sw1-GigabitEthernet0/0/2]port trunk allow-pass vlan all[sw1-GigabitEthernet0/0/2]quit[sw1]interfaceg0/0/3[sw1-GigabitEthernet0/0/3]port link-type trunk[sw1-GigabitEthernet0/0/3]port trunk allow-pass vlan all[sw1-GigabitEthernet0/0/3]quit

注:SW2相同配置划分在vlan20,自行配置

2)在SW4上做链路聚合,其他链路配置为trunk

[sw4]interface Eth-Trunk 1[sw4-Eth-Trunk1]mode lacp-static[sw4-Eth-Trunk1]trunkport GigabitEthernet 0/0/5 to 0/0/6[sw4-Eth-Trunk1]port link-type trunk[sw4-Eth-Trunk1]port trunk allow-passvlanall[sw4-Eth-Trunk1]quit[sw4]interface g0/0/2[sw4-GigabitEthernet0/0/2]port link-typetrunk[sw4-GigabitEthernet0/0/2]port trunk allow-pass vlan all[sw4-GigabitEthernet0/0/2]quit[sw4]interfaceg0/0/3[sw4-GigabitEthernet0/0/3]port link-type trunk[sw4-GigabitEthernet0/0/3]port trunk allow-pass vlan all[sw4-GigabitEthernet0/0/3]quit

注:SW3与SW4相同配置

(3)运行OSPF实现网络互联互通

W3的配置

[sw3]ospf[sw3-ospf-1]area 0[sw3-ospf-1-area-0.0.0.0]network 10.10.10.0 0.0.0.3[sw3-ospf-1-area-0.0.0.0]network 10.10.30.0 0.0.0.3

SW4的配置

[sw4]ospf[sw4-ospf-1]area 0[sw4-ospf-1-area-0.0.0.0]network 10.10.20.0 0.0.0.3[sw4-ospf-1-area-0.0.0.0]network 10.10.30.0 0.0.0.3

R1的配置

[R1]ospf[R1-ospf-1]area 0[R1-ospf-1-area-0.0.0.0]network 5.5.5.0 0.0.0.255[R1-ospf-1-area-0.0.0.0]network 10.10.20.0 0.0.0.3[R1-ospf-1-area-0.0.0.0]network 10.10.10.0 0.0.0.3

(4)配置VRRP和MSTP

1)在SW3和SW4上配置VRRP,实现多网关负载分担,并配置MSTP

SW3的配置

[sw3]interface Vlanif 10[sw3-Vlanif10]vrrp vrid 1 virtual-ip 192.168.1.254 //虚拟路由器的标识符为1,虚拟IP为192.168.1.254[sw3-Vlanif10]vrrp vrid 1 priority 120 //优先级设置为120,默认为1[sw3-Vlanif10]vrrp vrid 1 track interface GigabitEthernet 0/0/1 reduced 30 //抢占时间延迟时间为20s,默认为0[sw3-Vlanif10]quit[sw3]interface Vlanif 20[sw3-Vlanif20]vrrp vrid 2 virtual-ip 192.168.2.254[sw3-Vlanif20]quit[sw3]stp enable //启用STP,默认配置[sw3]stpmode mstp //STP的模式为MSTP,默认配置[sw3]stp region-configuration //进入MST域视图[sw3-mst-region]region-name vrrp //MSTP的域名为vrrp[sw3-mst-region]instance 1 vlan 10 //实例1关联vlan 10[sw3-mst-region]instance 2 vlan 20 //实例2关系vlan 20[sw3-mst-region]active region-configuration//激活MST域的配置[sw3-mst-region]quit[sw3]stp instance 1 root primary[sw3]stp instance 2 root secondary

在SW3上查看VRRP信息

[sw3]dis vrrp brief

VRIDStateInterfaceTypeVirtual IP

----------------------------------------------------------------

1MasterVlanif10Normal192.168.1.254

2MasterVlanif20Normal192.168.2.254

----------------------------------------------------------------

Total:2Master:2Backup:0Non-active:0

[sw3] User interface con0 is available

SW4的配置

[sw4]interface Vlanif 10[sw4-Vlanif10]vrrp vrid 1 virtual-ip 192.168.1.254[sw4-Vlanif10]vrrp vrid 1 priority 100[sw4-Vlanif10]quit[sw4]interface Vlanif 20[sw4-Vlanif20]vrrp vrid 2 virtual-ip 192.168.2.254[sw4-Vlanif20]quit[sw4]stp enable[sw4]stp mode mstp[sw4]stp region-configuration[sw4-mst-region]region-name vrrp[sw4-mst-region]instance 1 vlan 10[sw4-mst-region]instance 2 vlan 20[sw4-mst-region]quit[sw4]stp instance 1 root secondary[sw4]stp instance 2 root primary

在SW4上查看VRRP信息

[sw4]dis vrrp brief

VRIDStateInterfaceTypeVirtual IP

----------------------------------------------------------------

1BackupVlanif10Normal192.168.1.254

2BackupVlanif20Normal192.168.2.254

----------------------------------------------------------------

Total:2Master:0Backup:2Non-active:0

四、实验调试

在PC1上访问5.5.5.5,如图3-15所示。

图3-15在PC1上访问5.5.5.5

通过以上输出可以看到PC2访问3.3.3.3走的是SW3

更多的ensp网工实验案例和网工技术学习戳文章末尾卡片👇👇

http://www.jsqmd.com/news/269649/

相关文章:

  • 海南椰子鸡和宁夏滩羊的拼多多“漂流”:透视地域特产的数字进化论
  • 论文AI疑似度高达90%?别焦虑!这几招“物理降AI法”配合神器,让你轻松降AI率到10%!
  • 25个降AI提示词大全:适用DeepSeek/豆包/Kimi
  • 人群仿真软件:AnyLogic_(12).AnyLogic高级功能应用
  • 人群仿真软件:AnyLogic_(9).模型验证与校准
  • DeepSeek写的论文AI率98%怎么办?3招降到10%以下
  • 大模型训练全流程实战指南基础篇(三)——大模型本地部署实战(Vllm与Ollama)
  • 盘点全网最火的5款论文降AI神器:AI率狂飙90%怎么办?这几款工具一键去除AI痕迹
  • SCI投稿必备:6款期刊级降AI工具深度测评
  • Day17猜数字游戏
  • 毕业季来了!5款降AI率工具横评,最低能降到10%以下
  • 从 0 到 1 落地智能家居 AI 交互:LLaMA Factory Qwen3-4B 微调实战指南
  • AI赋能智汇高校 - 从零掌握大模型本地部署与微调全流程
  • 人群仿真软件:AnyLogic_(6).行为规则设定
  • 小程序毕设选题推荐:基于nodejs的大众点评美食版小程序美食推荐排行排名【附源码、mysql、文档、调试+代码讲解+全bao等】
  • Qt PDF模块详解 - 实践
  • 保姆级教程:25个降AI提示词大全,手把手教你去AI味
  • 2026国内最新虾青素保健品企业top5推荐!中青年抗衰品牌权威榜单发布,科学配方与品质保障助力健康年轻态 - 品牌推荐2026
  • 保姆级教程:DeepSeek降AI指令怎么写(附20个实用Prompt)
  • 云原生时代的Nginx:从反向代理到基础设施核心
  • AI 变声器在视频本地化中的应用:2026 年最佳工具与选型分析
  • “吉瓦时代”来临:Meta 核电协议引爆 AI 数据中心能源竞赛
  • AI智能客服系统重塑医药电商服务生态
  • 手把手教你把论文AI率从90%降到10%以下
  • Linux 搭建SVN服务
  • 学霸同款8个一键生成论文工具,MBA毕业论文轻松搞定!
  • 保姆级教程:DeepSeek降AI指令怎么写才有效
  • 数字赋能,防患未然——水利大坝智能监测与报警一体化平台
  • 查找oracle,存储过程包含某个单词的存储过程名称
  • 在Oracle中,包分为包头(PACKAGE)和包体(PACKAGE BODY),存储过程的实现代码在包体中。以下是几种查找方法