时间:2025-05-20 15:12
人气:
作者:admin
HSRP、GLBP、VRRP、NSRP 协议对比与配置指南
一、协议对比表
|
特性 |
HSRP (Cisco) |
GLBP (Cisco) |
VRRP (标准协议) |
NSRP (Juniper) |
|
协议类型 |
思科私有 |
思科私有 |
开放标准 (RFC 5798) |
Juniper私有 |
|
冗余模式 |
主备模式 |
主备 + 负载均衡 |
主备模式 |
主备模式(支持状态同步) |
|
负载均衡 |
不支持 |
支持(基于权重或轮询) |
不支持 |
不支持 |
|
收敛时间 |
约 10 秒 |
约 3-5 秒 |
约 3 秒 |
<1 秒(快速故障切换) |
|
虚拟 MAC |
统一虚拟 MAC |
动态分配多个虚拟 MAC |
统一虚拟 MAC |
无(基于实际 MAC) |
|
厂商支持 |
仅 Cisco 设备 |
仅 Cisco 设备 |
多厂商(华为、H3C 等) |
仅 Juniper 设备(如 SRX) |
|
典型应用 |
网关冗余 |
网关冗余 + 流量负载 |
跨厂商网关冗余 |
防火墙/安全网关冗余 |
二、优缺点分析
1. HSRP (Hot Standby Router Protocol)
2. GLBP (Gateway Load Balancing Protocol)
3. VRRP (Virtual Router Redundancy Protocol)
4. NSRP (Network Services Redundancy Protocol)
三、配置示例
1. HSRP 配置(Cisco IOS)
场景
A 机(主)配置
interface GigabitEthernet0/0
ip address 192.168.1.1 255.255.255.0
standby 1 ip 192.168.1.254
standby 1 priority 110 ! 主节点优先级更高
standby 1 preempt ! 启用抢占(故障恢复后自动切回主)
standby 1 timers 3 10 ! Hello时间3秒,保持时间10秒
standby 1 track GigabitEthernet0/1 20 ! 跟踪上行接口,故障时优先级降20
B 机(备)配置
interface GigabitEthernet0/0
ip address 192.168.1.2 255.255.255.0
standby 1 ip 192.168.1.254
standby 1 priority 90 ! 备用节点优先级较低
standby 1 preempt ! 备用节点也启用抢占(可选)
standby 1 timers 3 10 ! 必须与主节点时间参数一致
注意事项
2. GLBP 配置(Cisco IOS)
场景
A 机(主)配置
interface GigabitEthernet0/0
ip address 192.168.1.1 255.255.255.0
glbp 1 ip 192.168.1.254
glbp 1 priority 150 ! 主节点优先级更高
glbp 1 preempt ! 启用抢占
glbp 1 weighting 200 ! 权重值(流量分配比例)
glbp 1 load-balancing weighted ! 按权重分配流量
glbp 1 authentication md5 key-string MyKey ! 可选认证
glbp 1 track GigabitEthernet0/1 decrement 50 ! 跟踪上行接口,权重降50
B 机(备)配置
interface GigabitEthernet0/0
ip address 192.168.1.2 255.255.255.0
glbp 1 ip 192.168.1.254
glbp 1 priority 100 ! 备用节点优先级较低
glbp 1 preempt
glbp 1 weighting 150
glbp 1 load-balancing weighted
glbp 1 authentication md5 key-string MyKey
注意事项
3. VRRP 配置(华为/H3C)
场景
A 机(主)配置
interface Vlanif10
ip address 192.168.1.1 24
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 track interface GigabitEthernet0/0/1 reduced 30 ! 跟踪上行接口
vrrp vrid 1 authentication-mode md5 Huawei@123 ! 认证密码
B 机(备)配置
interface Vlanif10
ip address 192.168.1.2 24
vrrp vrid 1 virtual-ip 192.168.1.254
vrrp vrid 1 priority 100 ! 备用节点优先级较低
vrrp vrid 1 preempt-mode timer delay 20
vrrp vrid 1 authentication-mode md5 Huawei@123
注意事项
4. NSRP 配置(Juniper SRX)
场景
A 机(主)配置
set chassis cluster cluster-id 1 node 0 reboot ! 节点0为主
set interfaces ge-0/0/0 fabric-options member-interfaces ge-0/0/0 ! 心跳接口
set security nsrp cluster id 1 ! 集群ID
set security nsrp vsd-group 0 priority 254 ! 主节点优先级更高
set security nsrp vsd-group 0 monitor-interface ge-0/0/1 ! 监控内网接口
set security nsrp vsd-group 0 preempt ! 启用抢占
set security nsrp rto-sync ! 同步会话表
B 机(备)配置
set chassis cluster cluster-id 1 node 1 reboot ! 节点1为备
set interfaces ge-0/0/0 fabric-options member-interfaces ge-0/0/0
set security nsrp cluster id 1
set security nsrp vsd-group 0 priority 200
set security nsrp vsd-group 0 monitor-interface ge-0/0/1
set security nsrp rto-sync
注意事项
四、最佳技术方案选择
场景与推荐方案
根据实际需求选择协议,并严格遵循主备配置差异与注意事项,可确保高可用性网络的稳定运行。
五、总结
根据实际网络架构、设备厂商和业务需求选择最合适的协议。