1. 程式人生 > >基於華為防火墻雙機熱備

基於華為防火墻雙機熱備

引入 ren 動態 play 搶占模式 ces 其它 更新 動態關聯

理論部分

一:雙機熱備的工作原理
1:雙機熱備概述
傳統組網中,只有一臺防火墻部署在出口,當防火墻出現故障後,內部網絡中所有以防火墻作為默認網關的主機與外部網絡之間的通訊中斷,通訊可靠性無法保證。

雙機熱備份技術的出現改變了可靠性難以保證的尷尬狀態,通過在網絡出口位置部署兩臺或多臺網關設備,保證了內部網絡於外部網絡之間的通訊暢通。

2:雙機熱備的要求
兩臺防火墻用於心跳線的接口要加入相同的安全區域
兩臺防火墻用於心跳線的接口的設備編號必須一致
建議用於雙機熱備的兩臺防火墻采用相同的型號、相同的VRP版本

3:雙機熱備的模式
熱備模式
負載均衡模式

二:VRRP
VRRP(虛擬路由冗余協議)是一種容錯協議,它通過把幾臺路由設備聯合組成一臺虛擬的路由設備,並通過一定的機制來保證當主機的下一跳設備出現故障時,可以及時將業務切換到其它設備,從而保持通訊的連續性和可靠性。

1:VRRP基本概念
(1)VRRP路由器:運行VRRP的設備,它可能屬於一個或多個虛擬路由器。
(2)虛擬路由器:由VRRP管理的抽象設備,又稱為VRRP備份組,被當作一個共享局域網內主機的缺省網關。
(4)虛擬IP地址:虛擬路由器的IP地址,一個虛擬路由器可以有一個或多個IP地址,由用戶配置。
(6)IP地址擁有者:如果一個VRRP路由器將虛擬路由器的IP地址作為真實的接口地址,則該設備是IP地址擁有者。 IP地址擁有者默認的優先級為255.
(5)虛擬MAC地址:是虛擬路由器根據虛擬路由器ID生成的MAC地址。
(7)優先級:用於標識VRRP路由器的優先級,用於選舉主要設備和備用設備。VRRP默認的優先級為100,取值範圍是0--255,0是系統保留,255保留給IP地址擁有者

(8)搶占模式:在搶占模式下,如果Backup的優先級比當前Master的優先級高,將主動將自己升級成Master。
(9)非槍搶占模式:此模式不會以搶占的方式成為主要路由器

2:VRRP的角色
(1)Master路由器: 是承擔轉發報文或者應答ARP請求的VRRP路由器,默認每1秒向其他路由器通告master路由器當前的狀態信息
(2)Backup路由器:一組沒有承擔轉發任務的VRRP路由器,當Master設備出現故障時,它們將通過競選成為新的Master。

3:VRRP的狀態
Initialize(初始)狀態
Master狀態
Backup狀態

4:VRRP的工作原理
VRRP將局域網的一組路由器構成一個備份組,相當於一臺虛擬路由器。局域網內的主機只需要知道這個虛擬路由器的IP地址,並不需知道具體某臺設備的IP地址,將網絡內主機的缺省網關設置為該虛擬路由器的IP地址,主機就可以利用該虛擬網關與外部網絡進行通信。

VRRP將該虛擬路由器動態關聯到承擔傳輸業務的物理路由器上,當該物理路由器出現故障時,再次選擇新路由器來接替業務傳輸工作,整個過程對用戶完全透明,實現了內部網絡和外部網絡不間斷通信。

三:VGMP
為了解決多個VRRP備份組狀態不一致的問題,華為防火墻引入VGMP,來實現對VRRP備份組的統一管理,保證多個VRRP備份組狀態的一致性。VGMP是華為的私有協議

1:VGMP工作原理
默認情況下VGMP的優先級為45000
VGMP通過心跳線協商VGMP狀態信息

VGMP 有狀態和優先級兩個基本屬性,並且有三條基本運行原則:
(1)VGMP的狀態決定了組內VRRP備份組的狀態,也決定了防火墻的主備狀態。
(2)VGMP組的狀態是由兩臺防火墻的VGMP組通過比較優先級來決定的。優先級高的VGMP組狀態為Active,優先級低的VGMP組狀態為Standby。
(3)VGMP組會根據組內VRRP備份組的狀態變化來更新自己的優先級。每個VRRP備份組的狀態變成Initialize, VGMP組的優先級就會降低2。

2:VGMP的報文封裝
兩臺防火墻的VGMP組是通過VGMP報文來傳遞優先級信息的。
VGMP的報文有兩種形式:
?當心跳線直接相連,或通過二層交換機相連時,發送的報文屬於組播報文,並且不攜帶UDP頭部信息。
?當心跳線通過三層設備相連,組播是無法通過的,此時報文封裝中會額外加一個UDP頭部信息,發送時使用單播。

3:VGMP雙機熱備的備份方式
自動備份
手工批量備份
快速備份

實驗部分

實驗拓撲
技術分享圖片

實驗步驟
1:配置路由器R1的IP
<Huawei>undo terminal monitor
<Huawei>sys
[Huawei]sysname R1
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 10.1.1.1 24
[R1-GigabitEthernet0/0/0]quit
[R1]

[Huawei]ip route-static 192.168.1.0 24 10.1.1.100

2:配置防火墻FW1的IP地址

<USG6000V1>undo terminal monitor
<USG6000V1>sys
[USG6000V1]sysname FW1
[FW1]int g1/0/0
[FW1-GigabitEthernet1/0/0]ip add 10.1.1.101 24
[FW1-GigabitEthernet1/0/0]quit
[FW1]

[FW1]int g1/0/2
[FW1-GigabitEthernet1/0/2]ip add 192.168.1.101 24
[FW1-GigabitEthernet1/0/2]quit
[FW1]

[FW1]int g1/0/1
[FW1-GigabitEthernet1/0/1]ip add 172.16.1.1 24
[FW1-GigabitEthernet1/0/1]quit
[FW1]

3:配置防火墻FW2的IP地址
<USG6000V1>undo terminal monitor
<USG6000V1>sys
[USG6000V1]sysname FW2

[FW2]int g1/0/0
[FW2-GigabitEthernet1/0/0]ip add 10.1.1.102 24
[FW2-GigabitEthernet1/0/0]quit
[FW2]

[FW2]int g1/0/2
[FW2-GigabitEthernet1/0/2]ip add 192.168.1.102 24
[FW2-GigabitEthernet1/0/2]quit
[FW2]

[FW2]int g1/0/1
[FW2-GigabitEthernet1/0/1]ip add 172.16.1.2 24
[FW2-GigabitEthernet1/0/1]quit
[FW2]

4:將防火墻的接口加入相應的安全區域
(1)FW1的配置
[FW1]firewall zone trust
[FW1-zone-trust]add int g1/0/2
[FW1-zone-trust]quit

[FW1]firewall zone dmz
[FW1-zone-dmz]add int g1/0/1
[FW1-zone-dmz]quit

[FW1]firewall zone untrust
[FW1-zone-untrust]add int g1/0/0
[FW1-zone-untrust]quit

(2)FW2的配置
[FW1]firewall zone trust
[FW1-zone-trust]add int g1/0/2
[FW1-zone-trust]quit

[FW1]firewall zone dmz
[FW1-zone-dmz]add int g1/0/1
[FW1-zone-dmz]quit

[FW1]firewall zone untrust
[FW1-zone-untrust]add int g1/0/0
[FW1-zone-untrust]quit

5:配置安全策略
(1)FW1的配置
[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]quit

[FW1-policy-security]rule name permit_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]quit
[FW1-policy-security]quit
[FW1]

(2)FW2的配置
[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]quit

[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]quit
[FW2-policy-security]quit
[FW2]

5:配置VRRP備份組
(1)FW1的配置
[FW1]int g1/0/2
[FW1-GigabitEthernet1/0/2]vrrp vrid 1 virtual-ip 192.168.1.100 active
[FW1-GigabitEthernet1/0/2]quit
[FW1]

[FW1]int g1/0/0
[FW1-GigabitEthernet1/0/0]vrrp vrid 2 virtual-ip 10.1.1.100 active
[FW1-GigabitEthernet1/0/0]quit
[FW1]

註意:必須將同一個防火墻上的接口設置為同樣的狀態,就算設置的不同狀態,VGMP協議也會將他們置於相同的狀態

(2)FW2的配置
[FW2]int g1/0/2
[FW2-GigabitEthernet1/0/2]vrrp vrid 1 virtual-ip 192.168.1.100 standby
[FW2-GigabitEthernet1/0/2]quit
[FW2]

[FW2]int g1/0/0
[FW2-GigabitEthernet1/0/0]vrrp vrid 2 virtual-ip 10.1.1.100 standby
[FW2-GigabitEthernet1/0/0]quit
[FW2]

6:配置心跳線
(1)FW1的配置
[FW1]hrp interface g1/0/1 remote 172.16.1.2

(2)FW2的配置
[FW2]hrp interface g1/0/1 remote 172.16.1.1

7:啟用雙機熱備
(1)FW1上啟用
[FW1]hrp enable
HRP_S[FW1]

(2)FW2上啟用
[FW2]hrp enable
HRP_S[FW2]

8:配置備份方式
(1)FW1上的配置
HRP_M[FW1]hrp auto-sync

(2)FW2上的配置
HRP_S[FW2]hrp auto-sync

9:驗證雙機熱備
(1)查看雙機熱備的狀態信息(通過信息可以發現此時FW1是active,FW2是standby)
HRP_M[FW1]dis hrp state
Role: active, peer: standby
Running priority: 45000, peer: 45000
Core state: normal, peer: normal
Backup channel usage: 0.00%
Stable time: 0 days, 0 hours, 1 minutes
Last state change information: 2018-11-19 6:03:33 HRP core state changed, old_s
tate = abnormal(active), new_state = normal, local_priority = 45000, peer_priori
ty = 45000

HRP_S[FW2]dis hrp state
Role: standby, peer: active
Running priority: 45000, peer: 45000
Core state: normal, peer: normal
Backup channel usage: 0.00%
Stable time: 0 days, 0 hours, 1 minutes
Last state change information: 2018-11-19 6:03:33 HRP core state changed, old_s
tate = abnormal(standby), new_state = normal, local_priority = 45000, peer_prior
ity = 45000..

(2)查看心跳線
HRP_M[FW1]dis hrp inter
HRP_M[FW1]dis hrp interface
GigabitEthernet1/0/1 : running

HRP_S[FW2]dis hrp interface
GigabitEthernet1/0/1 : running

(3)在pc1上ping路由器R1進行測試

(4)查看安全規則
HRP_M<FW1>display security-policy rule permit_trust_untrust
(8 times matched)
rule name permit_trust_untrust
source-zone trust
destination-zone untrust
action permit

(5)查看會話表
HRP_M<FW1>dis firewall session table
Current Total Sessions : 7
icmp ×××: public --> public 192.168.1.1:45397 --> 10.1.1.1:2048
icmp ×××: public --> public 192.168.1.1:45909 --> 10.1.1.1:2048
icmp ×××: public --> public 192.168.1.1:45141 --> 10.1.1.1:2048
icmp ×××: public --> public 192.168.1.1:46165 --> 10.1.1.1:2048
icmp ×××: public --> public 192.168.1.1:45653 --> 10.1.1.1:2048
udp ×××: public --> public 172.16.1.2:49152 --> 172.16.1.1:18514
udp ×××: public --> public 172.16.1.1:49152 --> 172.16.1.2:18514

(6)down掉FW1的G1/0/2的接口,再次查看狀態信息,發現FW2已經成為了active
HRP_S<FW1>dis hrp state
Role: standby, peer: active (should be "active-standby")
Running priority: 44998, peer: 45000
Core state: abnormal(standby), peer: abnormal(active)
Backup channel usage: 0.00%
Stable time: 0 days, 0 hours, 2 minutes
Last state change information: 2018-11-19 6:22:35 HRP core state changed, old_s
tate = normal, new_state = abnormal(standby), local_priority = 44998, peer_prior
ity = 45000.

HRP_M<FW2>dis hrp state
Role: active, peer: standby (should be "standby-active")
Running priority: 45000, peer: 44998
Core state: abnormal(active), peer: abnormal(standby)
Backup channel usage: 0.00%
Stable time: 0 days, 0 hours, 5 minutes
Last state change information: 2018-11-19 6:22:35 HRP core state changed, old_s
tate = normal, new_state = abnormal(active), local_priority = 45000, peer_priori
ty = 44998.

基於華為防火墻雙機熱備