企业的两台FW的业务接口都工作在三层,上下行分别连接二层交换机。上行交换机连接运营商的接入点,运营商为企业分配的IP地址为1.1.1.1。现在希望两台FW以主备备份方式工作。正常情况下,流量通过FW_A转发。当FW_A出现故障时,流量通过FW_B转发,保证业务不中断。
注意心跳线要加入同一安全区域,内网设备的默认网关地址是vrrp备份组2的虚拟ip地址。
f1/f2
ip route-static 0.0.0.0 0.0.0.0 1.1.1.10
r1
ip route-static 0.0.0.0 0.0.0.0 1.1.1.1//下一跳地址是vrrp备份组1的虚拟ip地址
//f1
interface GigabitEthernet 1/0/1
vrrp vrid 1 virtual-ip 1.1.1.1 24 active//如果接口真实地址与vrrp备份组地址不在同一网段,需要指定掩码
interface GigabitEthernet 1/0/0
vrrp vrid 2 virtual-ip 10.3.0.3 24 active
//f2
interface GigabitEthernet 1/0/1
vrrp vrid 1 virtual-ip 1.1.1.1 24 standby//如果接口真实地址与vrrp备份组地址不在同一网段,需要指定掩码
interface GigabitEthernet 1/0/0
vrrp vrid 2 virtual-ip 10.3.0.3 24 standby
//f1
hrp interface GigabitEthernet 1/0/6 remote 10.10.0.2
hrp enable
//f2
hrp interface GigabitEthernet 1/0/6 remote 10.10.0.1
hrp enable
security-policy
rule name 1
source-zone trust
destination-zone untrust
source-address 10.3.0.0 mask 255.255.255.0
action permit
//配置公网地址池
nat address-group 1 0
mode pat
route enable
section 0 1.1.1.2 1.1.1.5
//配置源nat策略
nat-policy
rule name 1
source-zone trust
destination-zone untrust
source-address 10.3.0.0 mask 255.255.255.0
action source-nat address-group 1
HRP_Sdis vrrp
2022-02-15 00:52:35.430
GigabitEthernet1/0/1 | Virtual Router 1
State : Backup
Virtual IP : 1.1.1.1
Master IP : 10.2.0.1
PriorityRun : 120
PriorityConfig : 100
MasterPriority : 120
Preempt : YES Delay Time : 0 s
TimerRun : 60 s
TimerConfig : 60 s
Auth type : NONE
Virtual MAC : 0000-5e00-0101
Check TTL : YES
Config type : vgmp-vrrp
Backup-forward : disabled
Create time : 2022-02-15 00:33:52
Last change time : 2022-02-15 00:33:52
GigabitEthernet1/0/0 | Virtual Router 2
State : Backup
Virtual IP : 10.3.0.3
Master IP : 10.3.0.1
PriorityRun : 120
PriorityConfig : 100
MasterPriority : 120
Preempt : YES Delay Time : 0 s
TimerRun : 60 s
TimerConfig : 60 s
Auth type : NONE
Virtual MAC : 0000-5e00-0102
Check TTL : YES
Config type : vgmp-vrrp
Backup-forward : disabled
Create time : 2022-02-15 00:34:03
Last change time : 2022-02-15 00:34:03
可见fw2的上下行接口都处于backup状态,表示vrrp组建立成功。fw1的查看方式类似。
HRP_Mdis hrp state verbose
2022-02-15 00:56:40.090
Role: active, peer: standby
Running priority: 45000, peer: 45000
Backup channel usage: 0.00%
Stable time: 0 days, 0 hours, 21 minutes
Last state change information: 2022-02-15 0:35:19 HRP link changes to up.
Configuration:
hello interval: 1000ms
preempt: 60s
mirror configuration: off
mirror session: off
track trunk member: on
auto-sync configuration: on
auto-sync connection-status: on
adjust ospf-cost: on
adjust ospfv3-cost: on
adjust bgp-cost: on
nat resource: off
Detail information:
GigabitEthernet1/0/1 vrrp vrid 1: active
GigabitEthernet1/0/0 vrrp vrid 2: active
ospf-cost: +0
ospfv3-cost: +0
bgp-cost: +0
HRP_Sdis hrp state verbose
2022-02-15 00:55:15.890
Role: standby, peer: active
Running priority: 45000, peer: 45000
Backup channel usage: 0.00%
Stable time: 0 days, 0 hours, 19 minutes
Last state change information: 2022-02-15 0:35:19 HRP link changes to up.
Configuration:
hello interval: 1000ms
preempt: 60s
mirror configuration: off
mirror session: off
track trunk member: on
auto-sync configuration: on
auto-sync connection-status: on
adjust ospf-cost: on
adjust ospfv3-cost: on
adjust bgp-cost: on
nat resource: off
Detail information:
GigabitEthernet1/0/1 vrrp vrid 1: standby
GigabitEthernet1/0/0 vrrp vrid 2: standby
ospf-cost: +65500
ospfv3-cost: +65500
bgp-cost: +100
可见主备的优先级是相同的,但是active设备的ospf-cost、bgp-cost等都是为0的,而standby设备的则是65500,这样在配置了动态路由后,路由选路的时候就会优选active设备了。
//f1
HRP_Mdis fire session table
2022-02-15 01:04:23.230
Current Total Sessions : 6
udp VPN: public --> public 10.10.0.2:16384 --> 10.10.0.1:18514
udp VPN: public --> public 10.10.0.1:49152 --> 10.10.0.2:18514
udp VPN: public --> public 10.10.0.2:49152 --> 10.10.0.1:18514
icmp VPN: public --> public 10.3.0.100:2812[1.1.1.3:2053] --> 11.11.11.11:2048
icmp VPN: public --> public 10.3.0.100:3324[1.1.1.3:2055] --> 11.11.11.11:2048
icmp VPN: public --> public 10.3.0.100:3068[1.1.1.3:2054] --> 11.11.11.11:2048
//f2
HRP_Sdis fire session table
2022-02-15 01:04:10.630
Current Total Sessions : 6
udp VPN: public --> public 10.10.0.1:49152 --> 10.10.0.2:18514
udp VPN: public --> public 10.10.0.2:49152 --> 10.10.0.1:18514
udp VPN: public --> public 10.10.0.1:16384 --> 10.10.0.2:18514
icmp VPN: public --> public Remote 10.3.0.100:2812[1.1.1.3:2053] --> 11.11.11.11:2048
icmp VPN: public --> public Remote 10.3.0.100:3324[1.1.1.3:2055] --> 11.11.11.11:2048
icmp VPN: public --> public Remote 10.3.0.100:3068[1.1.1.3:2054] --> 11.11.11.11:2048
udp报文是hrp报文,用于fw之间同步表项以及关键配置。
icmp报文是ping包建立的会话,f2存在带有remote标记的会话,这些会话内容和f1是同步的.
HRP_S[f1]dis hrp state verbose
2022-02-15 01:10:07.130
Role: standby, peer: active (should be "active-standby")
Running priority: 44998, peer: 45000
Backup channel usage: 0.00%
Stable time: 0 days, 0 hours, 0 minutes
Last state change information: 2022-02-15 1:09:09 HRP core state changed, old_s
tate = normal, new_state = abnormal(standby), local_priority = 44998, peer_prior
ity = 45000.
Configuration:
hello interval: 1000ms
preempt: 60s
mirror configuration: off
mirror session: off
track trunk member: on
auto-sync configuration: on
auto-sync connection-status: on
adjust ospf-cost: on
adjust ospfv3-cost: on
adjust bgp-cost: on
nat resource: off
Detail information:
GigabitEthernet1/0/1 vrrp vrid 1: Initialize
GigabitEthernet1/0/0 vrrp vrid 2: standby (should be "active")
ospf-cost: +65500 (should be "+0")
ospfv3-cost: +65500 (should be "+0")
bgp-cost: +100 (should be "+0")
HRP_Mdis hrp state verbose
2022-02-15 01:11:09.590
Role: active, peer: standby (should be "standby-active")
Running priority: 45000, peer: 44998
Backup channel usage: 0.00%
Stable time: 0 days, 0 hours, 2 minutes
Last state change information: 2022-02-15 1:09:08 HRP core state changed, old_s
tate = normal, new_state = abnormal(active), local_priority = 45000, peer_priori
ty = 44998.
Configuration:
hello interval: 1000ms
preempt: 60s
mirror configuration: off
mirror session: off
track trunk member: on
auto-sync configuration: on
auto-sync connection-status: on
adjust ospf-cost: on
adjust ospfv3-cost: on
adjust bgp-cost: on
nat resource: off
Detail information:
GigabitEthernet1/0/1 vrrp vrid 1: active (should be "standby")
GigabitEthernet1/0/0 vrrp vrid 2: active (should be "standby")
ospf-cost: +0 (should be "+65500")
ospfv3-cost: +0 (should be "+65500")
bgp-cost: +0 (should be "+100")
原来的active设备由于出现了故障,则其优先级减2,成为了44998,故障接口变成了init状态,正常的下行接口被vgmp组从active变成了standby,而原来的standby设备上位成了active,同时将加入vgmp组的两个接口也变成了active。这样上下行接口的状态又一次同步,流量的源进源出得以保证。
这说明vgmp组控制了vrrp备份组的状态,在交换机或者路由器上,vrrp备份组的状态由vrrp优先级大小决定,防火墙的vrrp备份组状态则不是由vrrp优先级大小决定,而且通过实验我们发现,fw的vrrp优先级是不可以配置的,fw启用双机热备功能后,vrrp优先级固定为120.
在fw上,接口故障时,接口下vrrp备份组状态为init,接口无故障时,接口下的vrrp备份组状态由vgmp组的状态决定,具体是
当VGMP组状态为load-balance时,VRRP备份组状态由VRRP备份组的配置决定。即
vrrp vrid virtual-router-id virtual-ip virtual-address { active | standby }
a ctive表示指定vrrp备份组的状态为master,standby表示指定vrrp备份组的状态为backup。
丢包情况
出现了丢包,但数量很少。注意在真实环境中,不会出现丢包。
关于免费arp发包问题
active设备会主动发送免费arp,通告虚拟ip对应的虚拟mac地址。
发送的链路是自己的直连链路
发送时,二层的源mac是vrrp备份组的虚拟mac地址,目的mac地址是广播地址
免费arp的报文里面,源mac是vrrp备份组的虚拟mac地址,目的mac地址也是广播地址(如果是全0表示bug),源ip和目的ip均是vrrp备份组的虚拟ip地址。
关于vrrp通告报文问题
active设备会在直连链路上发送vrrp通告报文
使用的源mac地址是vrrp备份组虚拟ip对应的mac地址,目的mac地址是组播mac地址(224.0.0.18对应的)
源ip地址是接口的实际ip地址,目的ip地址是224.0.0.18
vrrp报文中,表示版本是2,包类型是1,vrid是1,优先级是120,虚拟ip地址是1.1.1.1
关于心跳报文问题
在心跳线上,会周期极为频繁的发送心跳报文,由于hrp是华为私有协议,所以协议报文难以解析
只能看到是udp报文,且 端口号随机固定。不仅是active发,standby也发。
另一个问题是心跳线上不存在vrrp报文。