华为交换机MSTP+VRRP配置实例说明文档

  • 拓扑图

  • IP地址规划表

设备名称

设备接口

对端设备

对端接口

VLAN

VLAN /接口地址

备注

SW0

GE0/0/23

SW2

GE0/0/23

VLAN200

10.0.1.1/24

 

GE0/0/24

SW1

GE0/0/24

VLAN100

10.0.0.1/24

 

SW1

GE0/0/24

SW0

GE0/0/24

VLAN100

10.0.0.2/24

 

GE0/0/11

GE0/0/12

SW1

GE0/0/11

GE0/0/12

VLAN 10:192.168.0.253/24

VLAN 20:192.168.1.253/24

Vir - ip: 192.168.0.254/24

Vir - ip: 192.168.1.254/24

链路聚合

Eth-trunk1

GE0/0/13

SW4

Eth0/0/13

 

GE0/0/1

SW3

GE0/0/1

 

SW2

GE0/0/23

SW0

GE0/0/23

VLAN200

10.0.1.2/24

 

GE0/0/11

GE0/0/12

SW1

GE0/0/11

GE0/0/12

VLAN 10:192.168.0.253/24

VLAN 20:192.168.1.253/24

Vir - ip: 192.168.0.254/24

Vir - ip: 192.168.1.254/24

链路聚合

Eth-trunk1

GE0/0/14

SW3

Eth0/0/14

 

GE0/0/1

SW4

GE0/0/1

 

SW3

GE0/0/1

SW1

GE0/0/1

     

Eth0/0/14

SW3

GE0/0/14

     

Eth0/0/1

CLENT1

Eth0/0/1

     

SW4

GE0/0/1

SW2

GE0/0/1

     

Eth0/0/13

SW1

GE0/0/13

     

Eth0/0/1

CLENT2

Eth0/0/1

     

CLENT1

Eth0/0/1

SW3

Eth0/0/1

 

192.168.0.1/24

 

CLENT2

Eth0/0/1

SW4

Eth0/0/1

 

192.168.1.1/24

 
  • MSTP简介

MSTP(多生成树协议)是在STP的基础上发展而来的,用于在局域网中消除数据链路层的物理环路,作为一种二层协议,MSTP通过选择性的阻塞网络中的冗余链路来消除二层环路,将环路网络结构修剪无环路的树型网络结构,从而防止在环路网络中不断增生和无限循环,避免设备由于重复接收相同报文造成报文处理能力的下降;同时,它还具备链路备份的能力。与STP相比,MSTP可以实现网络拓扑的快速收敛,也能使不同VLAN的流量沿各自的路径转发,从而为冗余链路提供了更好的负载分担机制。

  • VRRP简介

VRRP用来为网关设备提供冗余备份。VRRP将可以承担网关功能的一组设备加入到备份组中,形成一台虚拟路由器,局域网内的主机将此虚拟路由器设置为缺省网关。VRRP根据优先级从备份组中选举一台网关设备作为Master,负责转发局域网内主机与外部通信的流量,其他网关设备作为Backup。当Master出现故障后,VRRP重新选举新的Master,保证流量转发不会中断。

  • 配置脚本说明

[SW0]

<Huawei>sys

//进入特权模式

[Huawei]sysname SW0

//修改主机名

[SW0]vlan batch 100 200

//声明VLAN 100 200

[SW0]interface Vlanif100

//进入VLAN100的Svi接口模式

[SW0-Vlanif100]ip address 10.0.0.1 255.255.255.0

//配置VLAN100的Svi地址

[SW0-Vlanif100]qu

//退出Svi配置模式

[SW0]interface Vlanif200

//进入VLAN200的Svi接口模式

[SW0-Vlanif200]ip address 10.0.1.1 255.255.255.0

//配置VLAN100的Svi地址

[SW0-Vlanif200]qu

//退出VLAN200的接口配置模式

[SW0]interface GigabitEthernet 0/0/23

//进入到GE0/0/23的接口配置模式

[SW0-GigabitEthernet 0/0/23]port link-type access

//配置GE0/0/23的接口类型为access

[SW0-GigabitEthernet 0/0/23]port default vlan 200

//把GE0/0/23划分到VLAN200

[SW0-GigabitEthernet 0/0/23]qu

//退出GE0/0/23的接口模式

[SW0]interface GigabitEthernet0/0/24

//进入到GE0/0/24的接口配置模式

[SW0-GigabitEthernet 0/0/24]port link-type access

//配置GE0/0/24的接口类型为access

[SW0-GigabitEthernet 0/0/24]port default vlan 100

//把GE0/0/23划分到VLAN100

[SW0-GigabitEthernet 0/0/23]qu

//退出GE0/0/23的接口模式

[SW0]rip 1

//进入到RIP路由协议配置模式

[SW0-rip-1]network 10.0.0.0

//声明直连网段

[SW0-rip-1]qu

//退出RIP路由协议的配置模式

[SW0]qu

//退出特权模式

<SW0>sa

//保存配置

[SW1]

<Huawei>sys

//进入特权模式

[Huawei]sysname SW1

//修改主机名

[SW1]vlan batch 10 20 100

//声明VLAN 10 20 100

[SW1]interface Vlanif10

//进入VLAN10的Svi接口模式

[SW1-Vlanif10]ip address 192.168.0.253 255.255.255.0

//配置VLAN10的Svi地址

[SW1-Vlanif10]qu

//退出Svi配置模式

[SW1]interface Vlanif20

//进入VLAN20的Svi接口模式

[SW1-Vlanif20]ip address 192.168.1.253 255.255.255.0

//配置VLAN20的Svi地址

[SW1-Vlanif20]qu

//退出Svi配置模式

[SW1]interface Vlanif100

//进入VLAN100的Svi接口模式

[SW1-Vlanif100]ip address 10.0.0.2 255.255.255.0

//配置VLAN100的Svi地址

[SW1-Vlanif100]qu

//退出Svi配置模式

[SW1]interface Eth-Trunk1

//进入到链路聚合配置模式

[SW1-Eth-Trunk1]port link-type trunk

//配置聚合链路的链路类型为trunk

[SW1-Eth-Trunk1]port trunk allow-pass vlan 2 to 4094

//允许所有VLAN通过链路

[SW1-Eth-Trunk1]qu

//退出链路聚合配置模式

[SW1]interface GigabitEthernet0/0/1

//进入到GE0/0/1的接口配置模式

[SW1-GigabitEthernet 0/0/1]port link-type trunk

//配置GE0/0/1的链路类型为trunk

[SW1-GigabitEthernet 0/0/1]port trunk allow-pass vlan 2 to 4094

//允许所有VLAN通过链路

[SW1-GigabitEthernet 0/0/1]qu

//退出GE0/0/1的接口配置模式

[SW1]interface GigabitEthernet0/0/11

//进入到GE0/0/11的接口配置模式

[SW1-GigabitEthernet 0/0/11] eth-trunk 1

//将GE0/0/11加入到聚合链路中

[SW1-GigabitEthernet 0/0/11]qu

//退出链路接口配置模式

[SW1]interface GigabitEthernet0/0/12

//进入到GE0/0/12的接口配置模式

[SW1-GigabitEthernet 0/0/12]eth-trunk 1

//将GE0/0/12加入到聚合链路中

[SW1-GigabitEthernet 0/0/12]qu

//退出GE0/0/12的接口配置模式

[SW1]interface GigabitEthernet0/0/13

//进入到GE0/0/13的接口配置模式

[SW1-GigabitEthernet 0/0/13]port link-type trunk

//配置GE0/0/13的链路类型为trunk

[SW1-GigabitEthernet 0/0/13]port trunk allow-pass vlan 2 to 4094

//允许所有VLAN通过链路

[SW1-GigabitEthernet 0/0/13]qu

//退出GE0/0/13的接口配置模式

[SW1]interface GigabitEthernet0/0/24

//进入到GE0/0/24的接口配置模式

[SW1-GigabitEthernet 0/0/24]port link-type access

//配置GE0/0/24的链路类型为access

[SW1-GigabitEthernet 0/0/24]port default vlan 100

//将GE0/0/24划分到VLAN100

[SW1-GigabitEthernet 0/0/24]qu

//退出GE0/0/24的接口配置模式

【MSTP配置】

[SW1]stp region-configuration

//进入到stp配置模式

[SW1-mst-region] region-name vrrp

//配置MSTP名称

[SW1-mst-region]instance 1 vlan 10

//将VLAN10映射到实例1

[SW1-mst-region]instance 2 vlan 20

//将VLAN20映射到实例2

[SW1-mst-region]active region-configuration

//激活区域配置

[SW1-mst-region]qu

//退出MSTP配置模式

[SW1]stp instance 1 root primary

//设置实例1为主根

[SW1]stp instance 2 root secondary

//设置实例2为从根

【VRRP配置】

[SW1]interface Vlanif10

//进入到VLAN10的Svi接口模式下

[SW1-Vlanif10]vrrp vrid 1 virtual-ip 192.168.0.254

//声明虚拟备份组1并配置虚拟网关ip

[SW1-Vlanif10]vrrp vrid 1 priority 120

//配置虚拟备份组1的优先级为120

[SW1-Vlanif10]qu

//退出Svi接口配置模式

[SW1]interface Vlanif20

//进入到VLAN20的Svi接口模式下

[SW1-Vlanif20]vrrp vrid 2 virtual-ip 192.168.1.254

//声明虚拟备份组2并配置虚拟网关ip

[SW1-Vlanif20]qu

//退出Svi接口配置模式

[SW1]rip 1

//进入到RIP路由协议配置模式

[SW1-rip-1]network 10.0.0.0

//声明直连网段

[SW1-rip-1]network 192.168.0.0

//声明直连网段

[SW1-rip-1]network 192.168.1.0

//声明直连网段

[SW1-rip-1]qu

//退出RIP路由协议的配置模式

[SW1]qu

//退出特权模式

<SW1>sa

//保存配置

[SW2]

<Huawei>sys

//进入特权模式

[Huawei]sysname SW2

//修改主机名

[SW2]vlan batch 10 20 200

//声明VLAN 10 20 200

[SW2]interface Vlanif10

//进入VLAN10的Svi接口模式

[SW2-Vlanif10]ip address 192.168.0.253 255.255.255.0

//配置VLAN10的Svi地址

[SW2-Vlanif20]qu

//退出Svi配置模式

[SW2]interface Vlanif20

//进入VLAN20的Svi接口模式

[SW2-Vlanif20]ip address 192.168.1.253 255.255.255.0

//配置VLAN20的Svi地址

[SW2-Vlanif20]qu

//退出Svi配置模式

[SW2]interface Vlanif200

//进入VLAN200的Svi接口模式

[SW2-Vlanif200]ip address 10.0.1.2 255.255.255.0

//配置VLAN200的Svi地址

[SW2-Vlanif200]qu

//退出Svi配置模式

[SW2]interface Eth-Trunk1

//进入到链路聚合配置模式

[SW2-Eth-Trunk1]port link-type trunk

//配置聚合链路的链路类型为trunk

[SW2-Eth-Trunk1]port trunk allow-pass vlan 2 to 4094

//允许所有VLAN通过链路

[SW2-Eth-Trunk1]qu

//退出链路聚合配置模式

[SW2]interface GigabitEthernet0/0/1

//进入到GE0/0/1的接口配置模式

[SW2-GigabitEthernet 0/0/1]port link-type trunk

//配置GE0/0/1的链路类型为trunk

[SW2-GigabitEthernet 0/0/1]port trunk allow-pass vlan 2 to 4094

//允许所有VLAN通过链路

[SW2-GigabitEthernet 0/0/1]qu

//退出GE0/0/1的接口配置模式

[SW2]interface GigabitEthernet0/0/11

//进入到GE0/0/11的接口配置模式

[SW2-GigabitEthernet 0/0/11] eth-trunk 1

//将GE0/0/11加入到聚合链路中

[SW1-GigabitEthernet 0/0/11]qu

//退出链路接口配置模式

[SW2]interface GigabitEthernet0/0/12

//进入到GE0/0/12的接口配置模式

[SW2-GigabitEthernet 0/0/12]eth-trunk 1

//将GE0/0/12加入到聚合链路中

[SW2-GigabitEthernet 0/0/12]qu

//退出GE0/0/12的接口配置模式

[SW2]interface GigabitEthernet0/0/14

//进入到GE0/0/14的接口配置模式

[SW2-GigabitEthernet 0/0/14]port link-type trunk

//配置GE0/0/14的链路类型为trunk

[SW2-GigabitEthernet 0/0/14]port trunk allow-pass vlan 2 to 4094

//允许所有VLAN通过链路

[SW2-GigabitEthernet 0/0/14]qu

//退出GE0/0/14的接口配置模式

[SW2]interface GigabitEthernet0/0/23

//进入到GE0/0/23的接口配置模式

[SW2-GigabitEthernet 0/0/23]port link-type access

//配置GE0/0/23的链路类型为access

[SW2-GigabitEthernet 0/0/23]port default vlan 200

//将GE0/0/23划分到VLAN200

[SW2-GigabitEthernet 0/0/23]qu

//退出GE0/0/23的接口配置模式

【MSTP配置】

[SW2]stp region-configuration

//进入到stp配置模式

[SW2-mst-region] region-name vrrp

//配置MSTP名称

[SW2-mst-region]instance 1 vlan 10

//将VLAN10映射到实例1

[SW2-mst-region]instance 2 vlan 20

//将VLAN20映射到实例2

[SW2-mst-region]active region-configuration

//激活区域配置

[SW2-mst-region]qu

//退出MSTP配置模式

[SW2]stp instance 1 root secondary

//设置实例1为从根

[SW2]stp instance 2 root primary

//设置实例2为主根

【VRRP配置】

[SW2]interface Vlanif10

//进入到VLAN10的Svi接口模式下

[SW2-Vlanif10]vrrp vrid 1 virtual-ip 192.168.0.254

//声明虚拟备份组1并配置虚拟网关ip

[SW2-Vlanif10]qu

//退出Svi接口配置模式

[SW2]interface Vlanif20

//进入到VLAN20的Svi接口模式下

[SW2-Vlanif20]vrrp vrid 2 virtual-ip 192.168.1.254

//声明虚拟备份组2并配置虚拟网关ip

[SW2-Vlanif20]vrrp vrid 2 priority 120

//配置虚拟备份组2的优先级为120

[SW2-Vlanif20]qu

//退出Svi接口配置模式

[SW2]rip 1

//进入到RIP路由协议配置模式

[SW2-rip-1]network 10.0.0.0

//声明直连网段

[SW2-rip-1]network 192.168.1.0

//声明直连网段

[SW2-rip-1]network 192.168.0.0

//声明直连网段

[SW2-rip-1]qu

//退出RIP路由协议的配置模式

[SW2]qu

//退出特权模式

<SW2>sa

//保存配置

[SW3]

<Huawei>sys

//进入特权模式

[Huawei]sysname SW3

//修改主机名

[SW3]vlan batch 10 20

//声明VLAN 10 20

[SW3]interface Ethernet0/0/1

//进入到Eth0/0/1的接口模式

[SW3-Ethernet0/0/1]port link-type access

//配置Eth0/0/1的链路类型为access

[SW3-Ethernet0/0/1]port default vlan 10

//将Eth0/0/1划分到VLAN10

[SW3-Ethernet0/0/1]qu

//退出Eth0/0/1接口模式

[SW3]interface Ethernet0/0/14

//进入到Eth0/0/14的接口模式

[SW3-Ethernet0/0/14]port link-type trunk

//将Eth0/0/14的链路类型配置为trunk

[SW3-Ethernet0/0/14]port trunk allow-pass vlan 2 to 4094

//允许所有VLAN通过

[SW3-Ethernet0/0/14]qu

//退出Eth0/0/14的接口模式

[SW3]iinterface GigabitEthernet0/0/1

//进入到GE0/0/1的接口配置模式

[SW3-GigabitEthernet 0/0/1]port link-type trunk

//配置GE0/0/1的接口模式为trunk

[SW3-GigabitEthernet 0/0/1]port trunk allow-pass vlan 2 to 4094

//允许所有VLAN通过

[SW3-GigabitEthernet 0/0/1]qu

//退出GE0/0/1的接口配置模式

【MSTP】

[SW3]stp region-configuration

//进入到STP配置模式

[SW3]stp region-configuration

//进入到stp配置模式

[SW3-mst-region] region-name vrrp

//配置MSTP名称

[SW3-mst-region]instance 1 vlan 10

//将VLAN10映射到实例1

[SW3-mst-region]instance 2 vlan 20

//将VLAN20映射到实例2

[SW3-mst-region]active region-configuration

//激活区域配置

[SW3-mst-region]qu

//退出MSTP配置模式

[SW3]qu

//退出特权模式

<SW3>sa

//保存配置

[SW4]

<Huawei>sys

//进入特权模式

[Huawei]sysname SW4

//修改主机名

[SW4]vlan batch 10 20

//声明VLAN 10 20

[SW4]interface Ethernet0/0/1

//进入到Eth0/0/1的接口模式

[SW4-Ethernet0/0/1]port link-type access

//配置Eth0/0/1的链路类型为access

[SW4-Ethernet0/0/1]port default vlan 10

//将Eth0/0/1划分到VLAN10

[SW4-Ethernet0/0/1]qu

//退出Eth0/0/1接口模式

[SW4]interface Ethernet0/0/13

//进入到Eth0/0/13的接口模式

[SW4-Ethernet0/0/13]port link-type trunk

//将Eth0/0/13的链路类型配置为trunk

[SW4-Ethernet0/0/13]port trunk allow-pass vlan 2 to 4094

//允许所有VLAN通过

[SW4-Ethernet0/0/13]qu

//退出Eth0/0/13的接口模式

[SW4]iinterface GigabitEthernet0/0/1

//进入到GE0/0/1的接口配置模式

[SW4-GigabitEthernet 0/0/1]port link-type trunk

//配置GE0/0/1的接口模式为trunk

[SW4-GigabitEthernet 0/0/1]port trunk allow-pass vlan 2 to 4094

//允许所有VLAN通过

[SW4-GigabitEthernet 0/0/1]qu

//退出GE0/0/1的接口配置模式

【MSTP】

[SW4]stp region-configuration

//进入到STP配置模式

[SW4]stp region-configuration

//进入到stp配置模式

[SW4-mst-region] region-name vrrp

//配置MSTP名称

[SW4-mst-region]instance 1 vlan 10

//将VLAN10映射到实例1

[SW4-mst-region]instance 2 vlan 20

//将VLAN20映射到实例2

[SW4-mst-region]active region-configuration

//激活区域配置

[SW4-mst-region]qu

//退出MSTP配置模式

[SW4]qu

//退出特权模式

<SW4>sa

//保存配置

  • 总结

MSTP+VRRP配置步骤

1、配置交换机路由器的基本配置,例如接口信息、主机名等

2、配置交换机互连链路为trunk

3、配置主VRRP ID、虚拟IP、优先级,然后设置备VRRP的虚拟IP、优先级(此处的优先级一定要比主设备的低)

4、配置MSTP,进入MSTP配置接口、配置name、实例映射、激活,退出后设置主备

5、配置完成

最新文章

  1. Leetcode 255. Verify Preorder Sequence in Binary Search Tree
  2. Ansible-Tower快速入门-8.创建组织【翻译】
  3. 使用scala开发spark入门总结
  4. Spring MVC中处理静态资源的多种方法
  5. C++抽象机制之二:运算符重载
  6. centos telnet --xinetd 服务
  7. Thinkphp 文本编辑器
  8. (转载)iOS Framework: Introducing MKNetworkKit
  9. [置顶] hdu 4699 2个栈维护 or 伸展树
  10. #centos7 创建内网yum源 OpenStack源部署
  11. 使用dbms_profiler收集存储过程每步执行时间
  12. HTML5中的语义标签兼容IE8以及更低版本的浏览器
  13. centos nginx配置https
  14. iOS 去除百度地图下方的 logo
  15. 2017-2018-1 20155228 《数学建模》 MatlabR2017a安装教程
  16. [PHP] 09 - PHP 7 &amp; Tricky
  17. 浏览器的cookie的值改成字典格式
  18. Linux下的snmpd.conf配置说明
  19. sell 项目 订单详情表 设计 及 创建
  20. Python之shutil模块

热门文章

  1. java web 乱码终结
  2. Java 实现 HDFS 文件基本操作
  3. ORACLE更新数据时如果有就更新没有就插入
  4. Shell - Shell脚本调试方法
  5. .NET手记-Autofac进阶(注册的概念 Registering Concepts)
  6. linux中一些简便的命令之wc
  7. redis的安装使用以及在python中操作redis
  8. ida 调试 android fork
  9. 前后端分离demo 旅馆管理系统
  10. 一个简单有趣的Python音乐播放器