VRRP与HSRP实现对比
协议对比
表5-17 HSRP与VRRP协议对比
参数 | HSRP | VRRP |
---|---|---|
通用性 | Cisco私有协议,通用性差 | 标准协议,通用性好 |
协议报文目的MAC | 00-00-0c-07-ac-Group_ID | 00-00-5e-00-01-VRID |
协议报文目的IP | 224.0.0.2 | 224.0.0.18 |
TTL | 1 | 255 |
封装方式 | 封装在UDP报文内,端口号1985 | 封装在IP报文内 |
Hello报文缺省发送频率 | 发送周期3秒,9秒超时 | 发送周期1秒,3秒超时 |
Track接口能力 | 支持 | 支持 |
协议状态机 | 六种:Initial、Learn、Listen、Speak、Standby和Active | 三种:Initialize、Master和Backup |
命令对比
配置备份组
standby group-number ip virtual-ip-address
vrrp vrid virtual-router-id virtual-ip virtual-address
配置备份组优先级
standby group-number priority priority-value
vrrp vrid virtual-router-id priority priority-value
配置抢占
standby group-number Preempt
vrrp vrid virtual-router-id preempt-mode disable
配置hello消息计时器
standby group-number timers hellotime holdtime
vrrp vrid virtual-router-id timer advertise advertise-interval
查看备份组配置情况
show standby vlan vlan-number
show standby brief
show standby all
debug standby
display vrrp
display vrrp brief
debugging vrrp4 state interface interface-type interface-number vrid virtual-router-id
debugging vrrp4 packet interface interface-type interface-number vrid virtual-router-id [ verbose ]
debugging vrrp4 timer interface interface-type interface-number vrid virtual-router-id
配置与接口联动
standby group-number track type number interface-priority
vrrp vrid virtual-router-id track interface interface-type interface-number [ increased value-increased | reduced value-reduced ]
VRRP和HSRP对接/替换案例
HSRP与VRRP协议无法实现对接,因此替换方案为将HSRP下行主备链路同时割接至华为VRRP主备设备。
组网需求
如图1所示,组网中均为思科交换机。两台核心交换机采用堆叠方式。两台汇聚交换机之间使用手工模式的Eth-trunk进行链路冗余备份,上行通过配置OSPF与核心交换机建立OSPF邻居关系收发路由,下行通过配置HSRP实现虚拟网关备份,其中CiscoA为主用网关设备,CiscoB为备用网关设备。组网中交换机通过Rapid PVST+进行破环操作。
现根据需要,使用华为交换机替换组网中的两台汇聚交换机,且不改变原网络规划。
思科汇聚设备HSRP相关配置如下:
CiscoA
interface Vlan110
ip address 172.31.217.156 255.255.255.224
standby 110 ip 172.31.217.158
standby 110 priority 110
standby 110 preempt delay minimum 60
standby 110 authentication hsrp110
interface Vlan120
ip address 172.31.218.157 255.255.255.224
standby 120 ip 172.31.218.158
standby 120 authentication hsrp120
CiscoB
interface Vlan110
ip address 172.31.217.155 255.255.255.224
standby 110 ip 172.31.217.158
standby 110 authentication hsrp110
interface Vlan120
ip address 172.31.218.156 255.255.255.224
standby 120 ip 172.31.218.158
standby 120 priority 110
standby 120 preempt delay minimum 60
standby 120 authentication hsrp120
图1 HSRP组网图
配置思路
采用如下配置思路:
1、配置华为交换机的OSPF功能,实现与上行核心交换机建立OSPF邻居关系收发路由。
2、通过手工模式配置华为交换机之间的链路聚合,实现负载分担。
3、配置华为交换机的VRRP功能替换原思科交换机HSRP,实现虚拟网关备份。
4、配置华为交换机,实现与网络中其他思科交换机的环网互通,实现破坏。具体对接方案参见思科生成树协议和华为生成树协议对接/替换指导
5、依据原网络规划,配置华为交换机相关业务转发功能。
操作步骤
通过show standby brief命令查看设备的主备状态。
查看CiscoA设备的HSRP主备状态。
CiscoA# show standby brief
P indicates configured to preempt.
|
Interface Grp Pri P State Active Standby Virtual IP
Vlan110 110 110 P Active local 172.31.217.155 172.31.217.158
Vlan120 120 100 Standby 172.31.218.156 local 172.31.218.158
查看CiscoB设备的HSRP主备状态。
CiscoB# show standby brief
P indicates configured to preempt.
|
Interface Grp Pri P State Active Standby Virtual IP
Vlan110 110 100 Standby 172.31.217.156 local 172.31.217.158
Vlan120 120 110 P Active local 172.31.218.157 172.31.218.158
将两台华为交换机上电并通过旁挂的方式连接之间链路及上行链路。核心交换机新增下行接口地址,华为交换机新增上行接口地址及loopback地址,配置VRRP功能,其中HuaweiB配置为Master设备。完成华为交换机所有配置,并将下行链路接入侧的VLANIF接口shutdown。
配置HuaweiB的VRRP功能,配置其为VRRP备份组1的Master设备,备份组2的Backup设备。
<HUAWEI> system-view
[HUAWEI] sysname HuaweiB
[HuaweiB] interface vlanif 110
[HuaweiB-Vlanif110] ip address 172.31.217.156 255.255.255.224
[HuaweiB-Vlanif110] vrrp vrid 110 virtual-ip 172.31.217.158
[HuaweiB-Vlanif110] vrrp vrid 110 priority 110
[HuaweiB-Vlanif110] vrrp vrid 110 preempt-mode timer delay 60
[HuaweiB-Vlanif110] vrrp vrid 110 authentication-mode simple cipher vrrp110
[HuaweiB-Vlanif110] quit
[HuaweiB] interface vlanif 120
[HuaweiB-Vlanif120] ip address 172.31.218.157 255.255.255.224
[HuaweiB-Vlanif120] vrrp vrid 120 virtual-ip 172.31.218.158
[HuaweiB-Vlanif120] vrrp vrid 120 authentication-mode simple cipher vrrp120
[HuaweiB-Vlanif120] quit
配置HuaweiA的VRRP功能,配置其为VRRP备份组1的Backup设备,备份组2的Master设备。
<HUAWEI> system-view
[HUAWEI] sysname HuaweiA
[HuaweiA] interface vlanif 110
[HuaweiA-Vlanif110] ip address 172.31.217.155 255.255.255.224
[HuaweiA-Vlanif110] vrrp vrid 110 virtual-ip 172.31.217.158
[HuaweiA-Vlanif110] vrrp vrid 110 authentication-mode simple cipher vrrp110
[HuaweiA-Vlanif110] quit
[HuaweiA] interface vlanif 120
[HuaweiA-Vlanif120] ip address 172.31.218.156 255.255.255.224
[HuaweiA-Vlanif120] vrrp vrid 120 virtual-ip 172.31.218.158
[HuaweiA-Vlanif120] vrrp vrid 120 priority 110
[HuaweiA-Vlanif120] vrrp vrid 120 preempt-mode timer delay 60
[HuaweiA-Vlanif120] vrrp vrid 120 authentication-mode simple cipher vrrp120
[HuaweiA-Vlanif120] quit
根据思科设备的HSRP配置可以判断,CiscoA为活跃路由器,先将CiscoB下行接口shutdown,将连接CiscoD的物理线缆割接至HuaweiB,保持端口down。如下图所示:
图2 VRRP替换步骤一
将CiscoA下行接口shutdown,随即打开HuaweiB端口,业务完成切换。
测试HuaweiB下挂业务。验证无问题后,将原互连CiscoA和CiscoD的物理线缆割接至HuaweiA,打开HuaweiA端口。完成CiscoD的割接。如下图所示:
图3 VRRP替换步骤二
采用如上步骤,逐个完成下挂接入交换机的割接。配置完成后,查看华为设备的VRRP主备状态。
查看HuaweiB设备的VRRP主备状态。
[HuaweiB] display vrrp brief
VRID State Interface Type Virtual IP
----------------------------------------------------------------
110 Master Vlanif110 Normal 172.31.217.158
120 Backup Vlanif120 Normal 172.31.218.158
----------------------------------------------------------------
Total:2 Master:1 Backup:1 Non-active:0
查看HuaweiA设备的VRRP主备状态。
[HuaweiA] display vrrp brief
VRID State Interface Type Virtual IP
----------------------------------------------------------------
110 Backup Vlanif110 Normal 172.31.217.158
120 Master Vlanif120 Normal 172.31.218.158
----------------------------------------------------------------
Total:2 Master:1 Backup:1 Non-active:0