VRRP深度解析:手把手教会你VRRP如何配置

zkzhuhaha(魔力动车组) 的头像

0 评论

19 阅读

4,927 字,阅读时间 24 分。

01VRRP与HSRP技术全景对比

 VRRP(虚拟路由冗余协议)HSRP(热备份路由协议)
标准IEEE标准(RFC 5789)Cisco私有协议
虚拟MAC00-00-5E-00-01-{VRID}0000.0C07.AC{HSRP组号}
默认优先级100100
抢占模式关闭(默认)开启(默认)
认证MD5/明文MD5/明文
多组支持单设备支持255组单设备支持16组
负载均衡通过多VRRP组实现通过MHSRP实现

02核心应用场景

1️⃣企业出口网关冗余

VRRP深度解析:手把手教会你VRRP如何配置_img_1

效果:主设备故障时,50ms内切换,用户无感知

2️⃣数据中心多活架构

跨机柜部署:

Spine交换机A -- VRRP组1 -- Leaf交换机集群Spine交换机B -- VRRP组2 -- Leaf交换机集群

优势:避免单点故障导致全网瘫痪

3️⃣多WAN负载均衡

配置技巧:

创建多个VRRP组,不同组的主设备分布在不同线路

结合策略路由实现流量分流


03技术原理深度剖析

1️⃣VRRP工作流程

选举Master:比较优先级 (最高者胜出,相同则比较IP大小)

状态维持:Master定期发Advertisement报文 (默认1秒)

故障检测:Backup在3倍Advertisement间隔未收到报文则发起选举

虚拟IP接管:Master持有虚拟IP并响应ARP请求

报文结构:

VRRP深度解析:手把手教会你VRRP如何配置_img_2

2️⃣HSRP特色机制

状态跟踪:可监控上行链路状态自动降权

interface Gig0/0 standby 1 track Serial0/0/0 30# 链路故障时优先级减30

多组MHSRP:

interface Vlan10  standby 1 ip 192.168.1.254  standby 1 priority 110  standby 2 ip 192.168.1.253  standby 2 priority 90

04华为/思科双平台配置详解

VRRP深度解析:手把手教会你VRRP如何配置_img_3

1️⃣VRRP配置(华为设备)

# 基础配置 interface Vlanif10 ip address 192.168.1.1 255.255.255.0 vrrp vrid 1 virtual-ip 192.168.1.254 vrrp vrid 1 priority 120 vrrp vrid 1 preempt-mode timer delay 20 # 抢占延迟20秒 vrrp vrid 1 authentication-mode md5 Huawei@123 # 高级监控 vrrp vrid 1 track interface GigabitEthernet0/0/1 reduced 30

2️⃣HSRP配置(思科设备)

interface Vlan10 ip address 192.168.1.2 255.255.255.0 standby version 2 # 启用HSRPv2 standby 1 ip 192.168.1.254 standby 1 priority 110 standby 1 preempt standby 1 authentication md5 key-string Cisco@123 standby 1 track GigabitEthernet0/1 30

05故障排查命令大全

1️⃣华为VRRP诊断

display vrrp brief     # 查看VRRP组状态 display vrrp statistics   # 统计报文收发情况 debugging vrrp packet    # 实时抓取VRRP报文

2️⃣思科HSRP诊断

show standby brief     # 查看HSRP组摘要 show standby internal   # 显示内部计时器信息 debug standby events    # 跟踪状态切换事件

06生产环境最佳实践

优先级规划:

  • 主设备:120-150
  • 备用设备:90-110
  • 默认优先级:100

计时器优化:

# 华为调整Advertisement间隔 vrrp vrid 1 timer advertise 500 centiseconds

安全加固:

  • 启用MD5认证防止恶意接管
  • 限制VRRP报文源IP(ACL过滤)

多VLAN部署:

interface range Vlan10-20 standby 1 ip 192.168.1.254 standby 1 priority 110

07典型案例

VRRP深度解析:手把手教会你VRRP如何配置_img_4

本实验以ENSP环境为示例:

双vlan+vrrp组网方式配置详解

SW1:vlan batch 10 20 100#interface Vlanif10ip address 192.168.10.253 255.255.255.0vrrp vrid 1 virtual-ip 192.168.10.254vrrp vrid 1 priority 120vrrp vrid 1 preempt-mode timer delay 3vrrp vrid 1 track interface GigabitEthernet0/0/3#interface Vlanif20ip address 192.168.20.253 255.255.255.0vrrp vrid 2 virtual-ip 192.168.20.254vrrp vrid 2 priority 200#interface Vlanif100ip address 100.1.1.1 255.255.255.252#interface GigabitEthernet0/0/1description dT:LSW3-Eth0/0/2port link-type trunkport trunk allow-pass vlan 2 to 4094#interface GigabitEthernet0/0/2port link-type trunkport trunk allow-pass vlan 2 to 4094#interface GigabitEthernet0/0/3description uT:LSW4-GE0/0/1port link-type accessport default vlan 100#monitor-link group 1 #创建接口监控,如果0/0/3down掉,0/0/1也会down掉,方便切换port GigabitEthernet0/0/3 uplinkport GigabitEthernet0/0/1 downlink 1#ip route-static 3.3.3.0 255.255.255.0 100.1.1.2#
SW2:vlan batch 10 20 100 200#interface Vlanif10ip address 192.168.10.252 255.255.255.0vrrp vrid 1 virtual-ip 192.168.10.254vrrp vrid 1 priority 115#interface Vlanif20ip address 192.168.20.252 255.255.255.0vrrp vrid 2 virtual-ip 192.168.20.254vrrp vrid 2 priority 120vrrp vrid 2 preempt-mode timer delay 3vrrp vrid 2 track interface GigabitEthernet0/0/3#interface Vlanif200ip address 200.1.1.1 255.255.255.252#interface GigabitEthernet0/0/1description dT:LSW3-Eth0/0/3port link-type trunkport trunk allow-pass vlan 2 to 4094#interface GigabitEthernet0/0/2port link-type trunkport trunk allow-pass vlan 2 to 4094#interface GigabitEthernet0/0/3description uT:LSW4-GE0/0/2port link-type accessport default vlan 200#monitor-link group 1port GigabitEthernet0/0/3 uplinkport GigabitEthernet0/0/1 downlink 1#ip route-static 3.3.3.0 255.255.255.0 200.1.1.2#
SW3:vlan batch 10 20#interface Ethernet0/0/1port link-type accessport default vlan 10#interface Ethernet0/0/2port link-type trunkport trunk allow-pass vlan 2 to 4094#interface Ethernet0/0/3port link-type trunkport trunk allow-pass vlan 2 to 4094#interface Ethernet0/0/4port link-type accessport default vlan 20
SW4:vlan batch 100 200 300#interface Vlanif100ip address 100.1.1.2 255.255.255.252#interface Vlanif200ip address 200.1.1.2 255.255.255.252#interface Vlanif300ip address 3.3.3.3 255.255.255.0#interface GigabitEthernet0/0/1port link-type accessport default vlan 100#interface GigabitEthernet0/0/2port link-type accessport default vlan 200#interface GigabitEthernet0/0/3port link-type accessport default vlan 300#ip route-static 192.168.10.0 255.255.255.0 100.1.1.1ip route-static 192.168.10.0 255.255.255.0 200.1.1.1 preference 110ip route-static 192.168.20.0 255.255.255.0 100.1.1.1ip route-static 192.168.20.0 255.255.255.0 200.1.1.1 preference 90#

#️⃣配置完后,由于SW1为master,访问右侧PC-3.3.3.10时,路径为走SW1通过去访问目标。

VRRP深度解析:手把手教会你VRRP如何配置_img_5

#️⃣Down掉SW1的上行口后,master切换至下面,通过SW2的路径到达目标PC。

VRRP深度解析:手把手教会你VRRP如何配置_img_6
VRRP深度解析:手把手教会你VRRP如何配置_img_7

END

免责声明:本文内容来源于:

微信公众号

魔力动车组

,原文链接:

http://mp.weixin.qq.com/s?__biz=MzA3OTA1MjQxNA==&mid=2247484417&idx=1&sn=2f30b9d2f7153f3a6ce099b90b9ef182&chksm=9fb82f10a8cfa606f568605697e23ed99000d59dfa616b47565fbbadd8cf7b96b18acca6cf49#rd

本站为个人站点,相关文章均为网络公开资料,仅出于个人学习、研究及资料整理之用途转载收集,所有版权均归原作者及原发布平台所有。文末作者信息仅用于进行本站文章的分类信息使用,不代表原作者授权或者原作者入驻等依据。
本站不保证内容的完整性与准确性,亦不对内容承担任何法律责任。 如本文涉及版权问题,请原作者及时与我们联系,我们将在第一时间内进行删除处理。 本站尊重并遵守相关版权法规,倡导合法使用网络资源。 联系方式:[email protected]

zkzhuhaha(魔力动车组) 的头像

19篇作品

486总阅读量

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

更多文章

网工通信弱电的宝藏知识网站