01VRRP与HSRP技术全景对比
VRRP(虚拟路由冗余协议) | HSRP(热备份路由协议) | |
标准 | IEEE标准(RFC 5789) | Cisco私有协议 |
虚拟MAC | 00-00-5E-00-01-{VRID} | 0000.0C07.AC{HSRP组号} |
默认优先级 | 100 | 100 |
抢占模式 | 关闭(默认) | 开启(默认) |
认证 | MD5/明文 | MD5/明文 |
多组支持 | 单设备支持255组 | 单设备支持16组 |
负载均衡 | 通过多VRRP组实现 | 通过MHSRP实现 |
02核心应用场景
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请求
报文结构:

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华为/思科双平台配置详解

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典型案例

本实验以ENSP环境为示例:
双vlan+vrrp组网方式配置详解
SW1:
vlan batch 10 20 100
#
interface Vlanif10
ip address 192.168.10.253 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.10.254
vrrp vrid 1 priority 120
vrrp vrid 1 preempt-mode timer delay 3
vrrp vrid 1 track interface GigabitEthernet0/0/3
#
interface Vlanif20
ip address 192.168.20.253 255.255.255.0
vrrp vrid 2 virtual-ip 192.168.20.254
vrrp vrid 2 priority 200
#
interface Vlanif100
ip address 100.1.1.1 255.255.255.252
#
interface GigabitEthernet0/0/1
description dT:LSW3-Eth0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/3
description uT:LSW4-GE0/0/1
port link-type access
port default vlan 100
#
monitor-link group 1 #创建接口监控,如果0/0/3down掉,0/0/1也会down掉,方便切换
port GigabitEthernet0/0/3 uplink
port 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 Vlanif10
ip address 192.168.10.252 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.10.254
vrrp vrid 1 priority 115
#
interface Vlanif20
ip address 192.168.20.252 255.255.255.0
vrrp vrid 2 virtual-ip 192.168.20.254
vrrp vrid 2 priority 120
vrrp vrid 2 preempt-mode timer delay 3
vrrp vrid 2 track interface GigabitEthernet0/0/3
#
interface Vlanif200
ip address 200.1.1.1 255.255.255.252
#
interface GigabitEthernet0/0/1
description dT:LSW3-Eth0/0/3
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/3
description uT:LSW4-GE0/0/2
port link-type access
port default vlan 200
#
monitor-link group 1
port GigabitEthernet0/0/3 uplink
port 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/1
port link-type access
port default vlan 10
#
interface Ethernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface Ethernet0/0/3
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface Ethernet0/0/4
port link-type access
port default vlan 20
SW4:
vlan batch 100 200 300
#
interface Vlanif100
ip address 100.1.1.2 255.255.255.252
#
interface Vlanif200
ip address 200.1.1.2 255.255.255.252
#
interface Vlanif300
ip address 3.3.3.3 255.255.255.0
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 100
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 200
#
interface GigabitEthernet0/0/3
port link-type access
port default vlan 300
#
ip route-static 192.168.10.0 255.255.255.0 100.1.1.1
ip route-static 192.168.10.0 255.255.255.0 200.1.1.1 preference 110
ip route-static 192.168.20.0 255.255.255.0 100.1.1.1
ip route-static 192.168.20.0 255.255.255.0 200.1.1.1 preference 90
#
#️⃣配置完后,由于SW1为master,访问右侧PC-3.3.3.10时,路径为走SW1通过去访问目标。

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


END
发表回复