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

华为配置VRRP负载分担示例

组网需求

如图1所示,HostA和HostC通过Switch双归属到SwitchA和SwitchB。为减轻SwitchA上数据流量的承载压力,HostA以SwitchA为默认网关接入Internet,SwitchB作为备份网关;HostC以SwitchB为默认网关接入Internet,SwitchA作为备份网关,以实现流量的负载均衡。

说明

请确保该场景下互联接口的STP处于未使能状态。同时将互连接口退出VLAN1,避免形成环路。因为在使能STP的环形网络中,如果用交换机的VLANIF接口构建三层网络,会导致某个端口被阻塞,从而导致三层业务不能正常运行。

配置思路

采用VRRP负载分担实现流量的负载均衡,配置思路如下:

  1. 配置各设备接口IP地址及路由协议,使各设备间网络层连通。
  2. 在SwitchA和SwitchB上创建VRRP备份组1和VRRP备份组2,在备份组1中,配置SwitchA为Master设备,SwitchB为Backup设备;在备份组2中,配置SwitchB为Master设备,SwitchA为Backup设备,实现流量的负载均衡。

操作步骤

配置设备间的网络互连

# 配置设备各接口的IP地址,以SwitchA为例。SwitchB和SwitchC的配置与SwitchA类似

[zhonwanghzhi]interface GigabitEthernet 0/0/1
[zhonwanghzhi-GigabitEthernet0/0/1]port link-type hybrid 
[zhonwanghzhi-GigabitEthernet0/0/1]port hybrid pvid vlan 300
[zhonwanghzhi-GigabitEthernet0/0/1]port hybrid untagged vlan 300
[zhonwanghzhi-GigabitEthernet0/0/1]quit
[zhonwanghzhi]interface GigabitEthernet 0/0/2
[zhonwanghzhi-GigabitEthernet0/0/2]port link-type 
[zhonwanghzhi-port-group-link-type]quit
[zhonwanghzhi]interface GigabitEthernet 0/0/2	
[zhonwanghzhi-GigabitEthernet0/0/2]port link-type hybrid 
[zhonwanghzhi-GigabitEthernet0/0/2]port hybrid pvid vlan 100
[zhonwanghzhi-GigabitEthernet0/0/2]port hybrid untagged vlan 100
[zhonwanghzhi-GigabitEthernet0/0/2]quit
[zhonwanghzhi]
[zhonwanghzhi]interface Vlanif 100
[zhonwanghzhi-Vlanif100]ip address 10.1.1.1 24
[zhonwanghzhi-Vlanif100]quit
[zhonwanghzhi]interface Vlanif 300
[zhonwanghzhi-Vlanif300]ip address 192.168.1.1 24
[zhonwanghzhi-Vlanif300]quit
[zhonwanghzhi]

# 配置Switch的二层转发功能。


[zhongwanzhi]interface GigabitEthernet 0/0/1
[zhongwanzhi-GigabitEthernet0/0/1]port link-type hybrid 
[zhongwanzhi-GigabitEthernet0/0/1]port hybrid pvid vlan 100
[zhongwanzhi-GigabitEthernet0/0/1]port hybrid untagged vlan 100
[zhongwanzhi-GigabitEthernet0/0/1]quit
[zhongwanzhi]interface GigabitEthernet 0/0/2
[zhongwanzhi-GigabitEthernet0/0/2]port link-type hybrid 
[zhongwanzhi-GigabitEthernet0/0/2]port hybrid pvid vlan 100
[zhongwanzhi-GigabitEthernet0/0/2]port hybrid untagged vlan 100
[zhongwanzhi-GigabitEthernet0/0/2]quit
[zhongwanzhi]

# 配置SwitchA、SwitchB和SwitchC间采用OSPF协议进行互连。以SwitchA为例,SwitchB和SwitchC的配置与SwitchA类似

[zhonwanghzhi]ospf 1
[zhonwanghzhi-ospf-1]area 0
[zhonwanghzhi-ospf-1-area-0.0.0.0]network 10.1.1.0 0.0.0.255
[zhonwanghzhi-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
[zhonwanghzhi-ospf-1-area-0.0.0.0]quit
[zhonwanghzhi-ospf-1]quit

配置VRRP备份组

# 在SwitchA和SwitchB上创建VRRP备份组1,配置SwitchA的优先级为120,抢占延时为20秒,作为Master设备;SwitchB的优先级为缺省值,作为Backup设备。

SwitchA

[zhongwanzhi]interface Vlanif 100	
[zhongwanzhi-Vlanif100]vrrp vrid 1 virtual-ip 10.1.1.111
[zhongwanzhi-Vlanif100]vrrp vrid 1 priority 120
[zhongwanzhi-Vlanif100]vrrp vrid 1 preempt-mode timer delay 20
[zhongwanzhi-Vlanif100]quit

SwitchB

[zhonwanghzhib]interface Vlanif 100
[zhonwanghzhib-Vlanif100]vrrp vrid 1 virtual-ip 10.1.1.111
[zhonwanghzhib-Vlanif100]quit

# 在SwitchA和SwitchB上创建VRRP备份组2,配置SwitchB的优先级为120,抢占延时为20秒,作为Master设备;SwitchA的优先级为缺省值,作为Backup设备。

SwitchA

[zhonwanghzhi]interface Vlanif 100
[zhonwanghzhi-Vlanif100]vrrp vrid 2 virtual-ip 10.1.1.112
[zhonwanghzhi-Vlanif100]vrrp vrid 2 priority 120	
[zhonwanghzhi-Vlanif100]vrrp vrid 2 preempt-mode timer delay 20
[zhonwanghzhi-Vlanif100]quit

SwitchB

[zhonwanghzhib]interface Vlanif 100
[zhonwanghzhib-Vlanif100]vrrp vrid 1 virtual-ip 10.1.2.112
[zhonwanghzhib-Vlanif100]quit

验证配置结果

# 完成上述配置后,在SwitchA上执行display vrrp命令,可以看到SwitchA在备份组1中作为Master设备,在备份组2中作为Backup设备。

<zhonwanghzhi>display vrrpVlanif100 | Virtual Router 1State : MasterVirtual IP : 10.1.1.111Master IP : 10.1.1.1PriorityRun : 100PriorityConfig : 120MasterPriority : 120Preempt : YES   Delay Time : 0 sTimerRun : 1 sTimerConfig : 1 sAuth type : NONEVirtual MAC : 0000-5e00-0101Check TTL : YESConfig type : normal-vrrpCreate time : 2023-12-15 16:49:27 UTC-08:00Last change time : 2023-12-15 16:49:30 UTC-08:00Vlanif100 | Virtual Router 2State : Virtual IP : 10.1.1.112Master IP : 10.1.1.2PriorityRun : 110PriorityConfig : 110MasterPriority : 110Preempt : YES   Delay Time : 20 sTimerRun : 1 sTimerConfig : 1 sAuth type : NONEVirtual MAC : 0000-5e00-0102Check TTL : YESConfig type : normal-vrrpCreate time : 2023-12-15 16:56:51 UTC-08:00Last change time : 2023-12-15 16:56:55 UTC-08:00
http://www.lryc.cn/news/260434.html

相关文章:

  • 【Python】按升序排列 Excel 工作表
  • 定时器TIM HAL库+cubeMX(上)
  • 我常用的几个经典Python模块
  • 课堂练习4.4:页式虚存
  • javascript实现Stack(栈)数据结构
  • Layui深入
  • 网络层--TCP/UDP协议
  • 前端发送请求之参数处理---multipart/form-data与application/x-www-form-urlencoded
  • 解决Ubuntu16.04没声音
  • 12.14每日一题(备战蓝桥杯归并排序)
  • 面试__Java常见异常有哪些?
  • linux 网络子系统 摘要
  • java发起http、https请求,并携带cookie、header,post参数放body并可选关闭ssl证书验证,高可用版
  • windows系统nodeJs报错node-sass npm ERR! command failed
  • 从零构建属于自己的GPT系列5:模型部署1(文本生成函数解读、模型本地化部署、文本生成文本网页展示、代码逐行解读)
  • 电脑篇——360浏览器打开新标签页自定义,和关闭360导航(强迫症福音)
  • 常见的Linux基本指令
  • ESXI 6.7升级update3
  • bugku--source
  • SpringBoot Maven 项目打包的艺术--主清单属性缺失与NoClassDefFoundError的优雅解决方案
  • 2023-12-14 二叉树的最大深度和二叉树的最小深度以及完全二叉树的节点个数
  • 利用闭包与高阶函数实现缓存函数的创建
  • P1042 [NOIP2003 普及组] 乒乓球 JAVA 题解
  • 最大公因数,最小公倍数详解
  • 无脑利用API实现文心一言AI对话功能?(附代码)
  • 加速数据采集:用OkHttp和Kotlin构建Amazon图片爬虫
  • lua安装
  • 博士毕业需要发表几篇cssci论文
  • UDP报文格式详解
  • Python自动化测试如何自动生成测试用例?