作业十三:防火墙的双机热备
实验环境
实验思路
- 规划并配置IP
- 安全区域划分
- 配置静态路由
- 配置VRRP
- 配置心跳接口
- 配置安全策略
- 检验连通性
- 主备切换
- 备用设备抢占
实验步骤
规划并配置IP
R1:
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 200.1.1.3 24
FW1:
[FW1]int g1/0/2
[FW1-GigabitEthernet1/0/2]ip add 200.1.1.1 24
[FW1-GigabitEthernet1/0/2]int g1/0/1
[FW1-GigabitEthernet1/0/1]ip add 12.1.1.1 24
[FW1-GigabitEthernet1/0/1]int g1/0/0
[FW1-GigabitEthernet1/0/0]ip add 192.168.1.1 24
FW2:
[FW2]int g1/0/2
[FW2-GigabitEthernet1/0/2]ip add 200.1.1.2 24
[FW2-GigabitEthernet1/0/2]int g1/0/1
[FW2-GigabitEthernet1/0/1]ip add 12.1.1.2 24
[FW2-GigabitEthernet1/0/1]int g1/0/0
[FW2-GigabitEthernet1/0/0]ip add 192.168.1.2 24
PC1:
安全区域划分
FW1:
[FW1]firewall zone trust
[FW1-zone-trust]add int g1/0/0
[FW1-zone-trust]firewall zone untrust
[FW1-zone-untrust]add int g1/0/2
[FW1-zone-untrust]firewall zone dmz
[FW1-zone-dmz]add int g1/0/1
FW2:
[FW2]firewall zone trust
[FW2-zone-trust]add int g1/0/0
[FW2-zone-trust]firewall zone untrust
[FW2-zone-untrust]add int g1/0/2
[FW2-zone-untrust]firewall zone dmz
[FW2-zone-dmz]add int g1/0/1
配置静态路由
R1:
[R1]ip route-static 192.168.1.0 24 200.1.1.100
配置VRRP
FW1:
[FW1]int g1/0/0
[FW1-GigabitEthernet1/0/0]vrrp vrid 2 virtual-ip 192.168.1.100 active
[FW1-GigabitEthernet1/0/0]int g1/0/2
[FW1-GigabitEthernet1/0/2]vrrp vrid 1 virtual-ip 200.1.1.100 active
FW2:
[FW2]int g1/0/0
[FW2-GigabitEthernet1/0/0]vrrp vrid 2 virtual-ip 192.168.1.100 standby
[FW2-GigabitEthernet1/0/0]int g1/0/2
[FW2-GigabitEthernet1/0/2]vrrp vrid 1 virtual-ip 200.1.1.100 standby
配置心跳接口
FW1:
[FW1]hrp int g1/0/1 remote 12.1.1.2
[FW1]hrp enable
FW2:
[FW2]hrp int g1/0/1 remote 12.1.1.1
[FW2]hrp enable
配置安全策略
FW1:
HRP_M[FW1]security-policy (+B)
HRP_M[FW1-policy-security]rule name t_u (+B)
HRP_M[FW1-policy-security-rule-t_u]source-zone trust (+B)
HRP_M[FW1-policy-security-rule-t_u]destination-zone untrust (+B)
HRP_M[FW1-policy-security-rule-t_u]source-address 192.168.1.0 24 (+B)
HRP_M[FW1-policy-security-rule-t_u]service icmp (+B)
HRP_M[FW1-policy-security-rule-t_u]action permit (+B)
FW2查看同步的安全策略配置 :
HRP_S[FW2]display current-configuration
检验连通性
PC1 ping 200.1.1.3:
PC>ping 200.1.1.3
Ping 200.1.1.3: 32 data bytes, Press Ctrl_C to break
From 200.1.1.3: bytes=32 seq=1 ttl=254 time=172 ms
From 200.1.1.3: bytes=32 seq=2 ttl=254 time=63 ms
From 200.1.1.3: bytes=32 seq=3 ttl=254 time=62 ms
From 200.1.1.3: bytes=32 seq=4 ttl=254 time=62 ms
From 200.1.1.3: bytes=32 seq=5 ttl=254 time=46 ms
--- 200.1.1.3 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 46/81/172 ms
对FW1的g1/0/2抓包:
主备切换
FW1关闭上行接口:
HRP_M[FW1]int g1/0/2 (+B)
HRP_M[FW1-GigabitEthernet1/0/2]shutdown
FW1查看VRRP表:
HRP_S[FW1-GigabitEthernet1/0/2]dis vrrp
2021-03-24 08:43:20.690
GigabitEthernet1/0/2 | Virtual Router 1
State : Initialize
Virtual IP : 200.1.1.100
Master IP : 0.0.0.0
PriorityRun : 120
PriorityConfig : 100
MasterPriority : 0
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 : 2021-03-24 07:53:44
Last change time : 2021-03-24 08:42:56
GigabitEthernet1/0/0 | Virtual Router 2
State : Backup
Virtual IP : 192.168.1.100
Master IP : 192.168.1.2
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 : 2021-03-24 07:51:28
Last change time : 2021-03-24 08:42:56
FW2查看VRRP表:
HRP_M[FW2]dis vrrp
2021-03-24 08:44:43.560
GigabitEthernet1/0/2 | Virtual Router 1
State : Master
Virtual IP : 200.1.1.100
Master IP : 200.1.1.2
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 : 2021-03-24 07:55:21
Last change time : 2021-03-24 08:42:55
GigabitEthernet1/0/0 | Virtual Router 2
State : Master
Virtual IP : 192.168.1.100
Master IP : 192.168.1.2
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 : 2021-03-24 07:54:50
Last change time : 2021-03-24 08:42:55
PC1 ping 200.1.1.3
PC>ping 200.1.1.3
Ping 200.1.1.3: 32 data bytes, Press Ctrl_C to break
From 200.1.1.3: bytes=32 seq=1 ttl=254 time=78 ms
From 200.1.1.3: bytes=32 seq=2 ttl=254 time=46 ms
From 200.1.1.3: bytes=32 seq=3 ttl=254 time=62 ms
From 200.1.1.3: bytes=32 seq=4 ttl=254 time=62 ms
From 200.1.1.3: bytes=32 seq=5 ttl=254 time=47 ms
--- 200.1.1.3 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 46/59/78 ms
FW2上对g1/0/2抓包:
备用设备抢占
重连上行接口:
HRP_S[FW1-GigabitEthernet1/0/2]undo shutdown
PC1持续 ping 200.1.1.3 无丢包现象
查看FW1的VRRP表:
HRP_M[FW1-GigabitEthernet1/0/2]dis vrrp
2021-03-24 08:56:42.530
GigabitEthernet1/0/2 | Virtual Router 1
State : Master
Virtual IP : 200.1.1.100
Master IP : 200.1.1.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 : 2021-03-24 07:53:44
Last change time : 2021-03-24 08:56:07
GigabitEthernet1/0/0 | Virtual Router 2
State : Master
Virtual IP : 192.168.1.100
Master IP : 192.168.1.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 : 2021-03-24 07:51:28
Last change time : 2021-03-24 08:56:07
查看FW2的VRRP表:
HRP_S[FW2]dis vrrp
2021-03-24 08:58:15.540
GigabitEthernet1/0/2 | Virtual Router 1
State : Backup
Virtual IP : 200.1.1.100
Master IP : 200.1.1.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 : 2021-03-24 07:55:21
Last change time : 2021-03-24 08:56:06
GigabitEthernet1/0/0 | Virtual Router 2
State : Backup
Virtual IP : 192.168.1.100
Master IP : 192.168.1.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 : 2021-03-24 07:54:50
Last change time : 2021-03-24 08:56:06
实验总结
本次实验学习了VGMP以及HRP的原理和配置。VGMP的作用是将所有的VRRP备份组集中管理,控制状态同一切换。HRP则负责双机之间的数据同步,能备份会话和部分配置。处于Active状态的接口会定期发送 Hello报文,若有一个VRRP备份组故障则优先级减2。两台防火墙之间备份的数据是通过心跳口发送和接收的,通过心跳链路传输。配置VGMP后VRRP失效,优先级变为VRRP的优先级。