ENSP-----VGMP与HRP协议---防火墙的双机热备

一.防火墙双机热备介绍

双机热备的概述

  • 双机热备是为了解决单点故障,实现业务的平滑过渡(会话表需要同步)
  • 华为防火墙的双机热备模式有:热备模式、负载均衡模式

  • 主备备份指正常情况下仅由主用设备处理业务,备用设备空闲;当主用设备接口,链路或整机故障时,备用设备切换为主用设备,接替主用设备处理业务
  • 所谓负载分担,也可以称为“互为主备”,即两台设备同时处理业务,当其中一台设备发送故障时,另外一台设备会立即承担其业务,保证原来需要通过这台设备转发的业务不中断

VGMP简介

  • VGMP协议是华为公司的私有协议。VGMP协议中定义了VGMP组,FW基于VGMP组是实现设备主备状态管理
  • VGMP协议解决备份组切换不一致性的问题

VGMP的优先级

  • 中低端:Active设备优先级为65001,Standby设备优先级为6500
  • 高端:VGMP组初始优先级=45000+1000*LPU板上的插卡个数+2*SPU板上的CPU个数
  • USG6000,NGFW Module的初始化优先级都为45000

VGMP的状态转换与工作过程

  • 启用双机热备功能后,各VGMP组进入Initialize(初始化)状态。
  • 启用Active组后,Active组的状态由Initialize切换成Active。
  • 启用Standby组后,Standby组的状态由Initialize切换成Standby。
  • 本端VGMP组监控的接口故障时,状态由Active切换成A to S,并发送VGMP请求报文给对端设备的VGMP组。
  • 本端VGMP组收到对端的VGMP请求报文,发现自身优先级高,则将状态由Standby切换成Acitve,并发送VGMP确认报文给对端设备的VGMP组。
  • 本端VGMP组收到对端的VGMP确认报文,确认本端需要进行状态切换,则本端的VGMP组状态由A to S切换成Standby。
  • 对端VGMP组确认本端的VGMP组不需要进行状态切换或连续三次没有回应本端的VGMP请报文,则本端的VGMP组状态由A to S切换成Active。
  • 本端VGMP组监控的接口故障恢复后,如果本端VGMP组优先级高于对端且配置了抢占功能,则本端VGMP组状态由Standby切换成S to A,并向对端发送VGMP请求报文。
  • 本端VGMP组收到对端的VGMP请求报文,发现对端优先级高,则将状态由Active切换成Standby,并发送VGMP确认报文给对端设备的VGMP组。
  • 本端VGMP组收到对端的VGMP确认报文,确认本端需要进行状态切换,则本端的VGMP组状态由S to A切换成Active,完成抢占过程。
  • 对端VGMP组确认本端的VGMP组不需要进行状态切换或连续三次没有回应本端的VGMP请报文,则本端的VGMP组状态由S to A切换成Standby。
     

VGMP的工作原理(主备模式下)

  • 指定设备为Active和Standby
  • 将VGMP组内所有VRRP备份组状态为指定的Active standby(VRRP备份组状态的一致性)
  • Active设备发送免费ARP,刷新交换机MAC地址表(引导流量)
  • 周期性发送HRP心跳报文(周期1s 死亡3s),监控Active和Standby

VGMP的故障检测

  • 针对直连故障
A. 检测VRRP备份组状态
适用场景:防火墙业务接口工作在三层,上下接交换机(二层)

B. 检测三层接口的状态
适用场景: 防火墙业务接口工作在三层,上下接路由器
int xxxx
hrp track xxxx

C 检测VLAN接口状态
适用场景:防火墙业务接口工作在二层,上下接交换机(或者上下接路由器)
vlan xxx
hrp track XXXX
  • 非直连故障
IP-LINK
BFD

###IP-LINK
IP-Link是指FW通过向指定的目的IP周期性地发送探测报文并等待应答,
来判断链路是否发生故障。
FW发送探测报文后,在三个探测周期(默认为15s)内未收到响应报文,
则认为当前链路发生故障,IP-Link的状态变为Down。随后,
FW会进行IP-Link Down相关的后续操作,例如双机热备主备切换等。
当链路从故障中恢复,FW能连续地收到3个响应报文,则认为链路故障已经消除,
IP-Link的状态变为Up。也就是说,链路故障恢复后,IP-Link的状态并不会立即变为Up,
而是要等三个探测周期(默认为15s)才会变为Up。

HRP协议基本原理

  • HRP协议实现备份会话表等状态信息和关键的配置
  • HRP报文实际上是一种VGMP报文,承载在VGMP报文的Data区域。即存在两种封装方式
  • 管理面上的HRP报文会携带:指定自动备份还是批量备份,指定发送还是应答,备份的数据类型,两种方式如下

  • 转发层面的两种方式

  • 封装VRRP,组播224.0.0.18,不需要考虑受安全策略监控
  • 封装UDP,单播,需要考虑安全策略监控
  • 配置心跳线的时候需要考虑remote

HRP的备份方式

  • 自动备份,默认方式
  • 手动备份,批量方式(hrp sync config 手动触发批量备份)
  • 快速备份,针对分载分担

备份通道状态

  • 当设备两边均配置心跳口,防火墙会判断心跳接口的物理与协议状态。心跳链路一共存在五种状态
  • running:正常运行,能够发送报文
  • ready:正常运行,此接口为备份通道,当前未使用
  • peerdown:本段正常,但是收不到对端的心跳报文
  • invaild:未指定心跳地址的IP地址,心跳口工作在二层
  • down:心跳接口的物理状态与协议状态都为DOWN

当有多根心跳线时,哪个接口先配置的心跳线,即哪个接口的状态先成为ready,当两端心跳线通信时,先成为ready的接口就会成为running

当本端running接口down时,第二成为ready的接口会代替down的接口成为本端设备的running口。

继承顺序按照成为ready的时间,没有比较优先级等。只看时间戳。

当两端心跳有多根时,如果两端的running口不是一根链路,也可以正常通信

心跳线

  • 双机热备组网中,心跳线是两台FW交互消息了解对端状态以及备份配置命令和各种表项的通道。心跳线两端的接口通常称为“心跳接口”
  • 心跳线主要传递如下消息
心跳报文(hello报文):两台FW通过定期(默认周期为1秒)互相发送心跳报文检测对端设备是否存活
VGMP报文:了解对端设备的VGMP组状态,确定本端和对端设备当前状态是否稳定,是否要进行故障切换
配置和表项备份报文:用于两台FW同步配置命令和状态信息
心跳链路探测报文:用于检测对端设备的心跳口能否正常接收本端设备的报文,确定是否有心跳接口可以使用
配置一致性检查报文:用于检测两台FW的关键配置是否一致,比如安全策略、NAT等

二.防火墙双机热备实例

网络拓扑图

具体配置与分析

R1的配置

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R1
[R1]un in en
Info: Information center is disabled.
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 10.1.1.1 24
[R1-GigabitEthernet0/0/0]un sh
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[R1-GigabitEthernet0/0/0]q
[R1]int loo0
[R1-LoopBack0]ip add 1.1.1.1 32
[R1-LoopBack0]q	
[R1]ip route-static 192.168.10.0 24 10.1.1.100    //向下配置静态回程路由

FW1的配置

<USG6000V1>sys
Enter system view, return user view with Ctrl+Z.
[USG6000V1]sysname FW1
[FW1]un in en
Info: Saving log files...
Info: Information center is disabled.
[FW1]int g1/0/0
[FW1-GigabitEthernet1/0/0]ip add 10.1.1.101 24
[FW1-GigabitEthernet1/0/0]un sh
Info: Interface GigabitEthernet1/0/0 is not shutdown.
[FW1-GigabitEthernet1/0/0]q
[FW1]int g1/0/1
[FW1-GigabitEthernet1/0/1]ip add 172.16.1.1 24
[FW1-GigabitEthernet1/0/1]un sh
Info: Interface GigabitEthernet1/0/1 is not shutdown.
[FW1-GigabitEthernet1/0/1]q
[FW1]firewall zone untrust    //定义各个区域的接口
[FW1-zone-untrust]add int g1/0/0
[FW1-zone-untrust]firewall zone dmz
[FW1-zone-dmz]add int g1/0/1
[FW1-zone-dmz]firewall zone trust
[FW1-zone-trust]add int g1/0/2
[FW1-zone-trust]q
[FW1]ip route-static 0.0.0.0 0.0.0.0 10.1.1.1    //向上配置回程路由	
[FW1]security-policy    //配置安全策略	
[FW1-policy-security]rule name permit_heat    //定义规则名字
[FW1-policy-security-rule-permit_heat]source-zone local    //定义源区域
[FW1-policy-security-rule-permit_heat]destination-zone dmz    //定义目的区域
[FW1-policy-security-rule-permit_heat]action permit    //动作设为允许
[FW1-policy-security-rule-permit_heat]q
[FW1-policy-security]rule name permit_trust_untrust    //配置trust与untrust区域规则
[FW1-policy-security-rule-permit_trust_untrust]source-zone trust
[FW1-policy-security-rule-permit_trust_untrust]destination-zone untrust
[FW1-policy-security-rule-permit_trust_untrust]action permit
[FW1-policy-security-rule-permit_trust_untrust]q
[FW1]int g1/0/2
[FW1-GigabitEthernet1/0/2]ip add 192.168.10.101 24
###定义下联口VRRP主组,以及虚拟IP地址
[FW1-GigabitEthernet1/0/2]vrrp vrid 1 virtual-ip 192.168.10.100 active 
[FW1-GigabitEthernet1/0/2]un sh
Info: Interface GigabitEthernet1/0/2 is not shutdown.
[FW1-GigabitEthernet1/0/2]q
[FW1]int g1/0/0
###定义上联口VRRP主组,以及虚拟IP地址
[FW1-GigabitEthernet1/0/0]vrrp vrid 2 virtual-ip 10.1.1.100 active
[FW1-GigabitEthernet1/0/0]un sh
Info: Interface GigabitEthernet1/0/0 is not shutdown.
[FW1-GigabitEthernet1/0/0]q
[FW1]hrp int g1/0/1 remote 172.16.1.2    //配置心跳接口
[FW1]hrp enable    //启动双机热备
Info: NAT IP detect function is disabled.
HRP_S[FW1]hrp auto-sync    //定义双机热备方式为自动备份
HRP_S[FW1]display hrp state    //查看双机热备状态信息
2020-02-16 11:25:47.720 
 Role: standby, peer: unknown
 Running priority: 45000, peer: unknown
 Backup channel usage: 0.00%
 Stable time: 0 days, 0 hours, 0 minutes
 Last state change information: 2020-02-16 11:25:11 HRP core state changed, old_
state = initial, new_state = abnormal(standby), local_priority = 45000, peer_pri
ority = unknown.

HRP_S[FW1]dis hrp int    //查看心跳接口状态信息
2020-02-16 11:26:14.920 
             GigabitEthernet1/0/1 : negotiation failed

HRP_S[FW1]

FW2的配置

<USG6000V1>sys
Enter system view, return user view with Ctrl+Z.
[USG6000V1]sysname FW2
[FW2]un in en
Info: Saving log files...
Info: Information center is disabled.
[FW2]int g1/0/0
[FW2-GigabitEthernet1/0/0]ip add 10.1.1.102 24
[FW2-GigabitEthernet1/0/0]un sh
Info: Interface GigabitEthernet1/0/0 is not shutdown.
[FW2-GigabitEthernet1/0/0]q
[FW2]int g1/0/1
[FW2-GigabitEthernet1/0/1]ip add 172.16.1.2 24
[FW2-GigabitEthernet1/0/1]un sh
Info: Interface GigabitEthernet1/0/1 is not shutdown.
[FW2-GigabitEthernet1/0/1]q	
[FW2]firewall zone untrust 
[FW2-zone-untrust]add int g1/0/0
[FW2-zone-untrust]q
[FW2]firewall zone dmz
[FW2-zone-dmz]add int g1/0/1
[FW2-zone-dmz]firewall zone trust
[FW2-zone-trust]add int g1/0/2
[FW2-zone-trust]q
[FW2]ip route-static 0.0.0.0 0.0.0.0 10.1.1.1
[FW2]security-policy 
[FW2-policy-security]rule name permit_heat
[FW2-policy-security-rule-permit_heat]source-zone local	
[FW2-policy-security-rule-permit_heat]destination-zone dmz	
[FW2-policy-security-rule-permit_heat]action permit
[FW2-policy-security-rule-permit_heat]q
[FW2-policy-security]rule name permit_trust_untrust
[FW2-policy-security-rule-permit_trust_untrust]source-zone trust	
[FW2-policy-security-rule-permit_trust_untrust]destination-zone untrust	
[FW2-policy-security-rule-permit_trust_untrust]action permit 
[FW2-policy-security-rule-permit_trust_untrust]q
[FW2-policy-security]int g1/0/2
[FW2-GigabitEthernet1/0/2]ip add 192.168.10.102 24
###定义下联口虚拟IP地址,以及VRRP为备组状态
[FW2-GigabitEthernet1/0/2]vrrp vrid 1 virtual-ip 192.168.10.100 standby 
[FW2-GigabitEthernet1/0/2]un sh
Info: Interface GigabitEthernet1/0/2 is not shutdown.
[FW2-GigabitEthernet1/0/2]q
[FW2]int g1/0/0
###定义上联口虚拟IP地址,以及VRRP为备组状态
[FW2-GigabitEthernet1/0/0]vrrp vrid 2 virtual-ip 10.1.1.100 standby 
[FW2-GigabitEthernet1/0/0]un sh
Info: Interface GigabitEthernet1/0/0 is not shutdown.
[FW2-GigabitEthernet1/0/0]q
[FW2]hrp int g1/0/1 remote 172.16.1.1
[FW2]hrp enable
Info: NAT IP detect function is disabled.	
HRP_S[FW2]hrp auto-sync 
HRP_S[FW2]dis hrp state
2020-02-16 11:34:15.410 
 Role: standby, peer: active
 Running priority: 45000, peer: 45000
 Backup channel usage: 0.02%
 Stable time: 0 days, 0 hours, 0 minutes
 Last state change information: 2020-02-16 11:34:08 HRP core state changed, old_
state = abnormal(active), new_state = normal, local_priority = 45000, peer_prior
ity = 45000.

HRP_S[FW2]dis hrp int
2020-02-16 11:34:28.650 
             GigabitEthernet1/0/1 : running

HRP_S[FW2]

实验验证

  • 抓取心跳线处的数据包,其协议为UDP

  • 由PC1处pingR1的环回地址

  • 模拟故障切换,在FW1上down掉下联口,再从pc1pingR1

  • 恢复故障之后,由于抢占机制,fw1由standby变为active

 

 

  • 6
    点赞
  • 36
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值