華爲USG防火牆雙機熱備(業務口工做在三層上下行鏈接路由器)

上一篇中防火牆上下行業務口工做在二層,VGMP能夠經過VRRP來監控接口狀態。那麼若是上下行接口工做在三層,那麼VGMP顯然不能經過VRRP來監控接口狀態此時就須要VGMP直接監控接口狀態。session


實驗拓撲負載均衡

wKiom1cDfICSqdsTAAC86gHjGOg448.png

環境描述ide

全網運行OSPF宣告在區域0中,將FW1和FW2的G0/0/0的接口加入到VRRP 1中,G0/0/1接口加入到DMZ區域G0/0/2接口加入到untrust區域。oop

IP地址:R1 loopback:1.1.1.1/32學習

        R2 loopback:2.2.2.2/32
測試

        FW1 loopback:100.100.100.100/32
ui

        FW2 loopback:200.200.200.200/32
spa


因爲主要講防火牆因此IP地址和OSPF配置省略router


FW1配置blog


-----------------------------將接口加入對應的區域----------------------------

[FW1]firewall zone trust

[FW1-zone-trust]add int g0/0/0

[FW1-zone-trust]quit

[FW1]firewall zone dmz

[FW1-zone-dmz]add int g0/0/1

[FW1-zone-dmz]quit

[FW1]firewall zone untrust 

[FW1-zone-untrust]add int g0/0/2

[FW1-zone-untrust]quit


------------------------------------配置接口IP-------------------------------

[FW1]int g0/0/0

[FW1-GigabitEthernet0/0/0]ip add 11.0.0.1 24

[FW1-GigabitEthernet0/0/0]int g0/0/1

[FW1-GigabitEthernet0/0/1]ip add 10.10.10.1 24

[FW1-GigabitEthernet0/0/1]int g0/0/2

[FW1-GigabitEthernet0/0/2]ip add 13.0.0.1 24

[FW1-GigabitEthernet0/0/2]quit

[FW1-LoopBack0]ip add 100.100.100.100 32

[FW1-LoopBack0]quit


---------------------------配置OSPF------------------------------------------------

[FW1]ospf 1 router-id 100.100.100.100

[FW1-ospf-1]area 0

[FW1-ospf-1-area-0.0.0.0]network 100.100.100.100 0.0.0.0

[FW1-ospf-1-area-0.0.0.0]network 11.0.0.0 0.0.0.255

[FW1-ospf-1-area-0.0.0.0]network 13.0.0.0 0.0.0.255

[FW1-ospf-1-area-0.0.0.0]quit

[FW1-ospf-1]quit


----------------------------配置區域間策略--------------------------------------------

[FW1]policy interzone local untrust inbound 

[FW1-policy-interzone-local-untrust-inbound]policy 1

[FW1-policy-interzone-local-untrust-inbound-1]policy source 192.168.20.0 0.0.0.255

[FW1-policy-interzone-local-untrust-inbound-1]action permit 

[FW1-policy-interzone-local-untrust-inbound-1]quit

[FW1-policy-interzone-local-untrust-inbound]quit

[FW1]policy interzone trust untrust outbound 

[FW1-policy-interzone-trust-untrust-outbound]policy 1

[FW1-policy-interzone-trust-untrust-outbound-1]action permit 

[FW1-policy-interzone-trust-untrust-outbound-1]quit

[FW1-policy-interzone-trust-untrust-outbound]quit


----------------------------配置雙機熱備-------------------------------------------

[FW1]hrp enable                   //開啓HRP功能

[FW1]hrp mirror session enable         //開啓會話快速備份

[FW1]hrp int g0/0/1                        //指定心跳接口

[FW1-GigabitEthernet0/0/2]hrp track master     //配置VGMP監聽端口並配置爲主

HRP_M[FW1-GigabitEthernet0/0/2]int g0/0/1

HRP_M[FW1-GigabitEthernet0/0/1]hrp track master 


FW2配置


[FW2]firewall zone trust

[FW2-zone-trust]add int g0/0/0

[FW2-zone-trust]quit

[FW2]firewall zone dmz

[FW2-zone-dmz]add int g0/0/1

[FW2-zone-dmz]quit

[FW2]firewall zone untrust

[FW2-zone-untrust]add int g0/0/2

[FW2-zone-untrust]quit


[FW2]int g0/0/0

[FW2-GigabitEthernet0/0/0]ip add 12.0.0.1 24

[FW2-GigabitEthernet0/0/0]int g0/0/1

[FW2-GigabitEthernet0/0/1]ip add 10.10.10.2 24

[FW2-GigabitEthernet0/0/1]int g0/0/2

[FW2-GigabitEthernet0/0/2]ip add 22.0.0.1 24

[FW2-GigabitEthernet0/0/2]quit

[FW2]int loo 0

[FW2-LoopBack0]ip add 200.200.200.200 32

[FW2-LoopBack0]quit

[FW2]ospf 1 router-id 200.200.200.200

[FW2-ospf-1]area 0

[FW2-ospf-1-area-0.0.0.0]net 200.200.200.200 0.0.0.0

[FW2-ospf-1-area-0.0.0.0]net 12.0.0.0 0.0.0.255 

[FW2-ospf-1-area-0.0.0.0]net 22.0.0.0 0.0.0.255

[FW2-ospf-1-area-0.0.0.0]quit

[FW2-ospf-1]quit


[FW2]policy interzone trust untrust outbound 

[FW2-policy-interzone-trust-untrust-outbound]policy 1

[FW2-policy-interzone-trust-untrust-outbound-1]action permit 

[FW2-policy-interzone-trust-untrust-outbound-1]quit

[FW2-policy-interzone-trust-untrust-outbound]quit

[FW2]policy interzone local untrust inbound 

[FW2-policy-interzone-local-untrust-inbound]policy 1

[FW2-policy-interzone-local-untrust-inbound-1]policy source 192.168.20.0 0.0.0.255

[FW2-policy-interzone-local-untrust-inbound-1]action permit 

[FW2-policy-interzone-local-untrust-inbound-1]quit

[FW2-policy-interzone-local-untrust-inbound]quit


[FW2]hrp enable

[FW2]hrp mirror session enable 

[FW2]hrp auto-sync

[FW2]hrp int g0/0/1

HRP_S[FW2-GigabitEthernet0/0/0]hrp track slave 

HRP_S[FW2-GigabitEthernet0/0/0]hrp track

HRP_S[FW2-GigabitEthernet0/0/0]int g0/0/2

HRP_S[FW2-GigabitEthernet0/0/2]hrp track slave 

HRP_S[FW2-GigabitEthernet0/0/2]quit



因爲在這個圖中R1學習R2的路由開銷都是同樣的,因此默認學到的R1的路由都會負載均衡(如圖)。這樣會出現數據包來回路徑不一致的問題,解決這個問題有2種辦法一種是手動修改R1和R2的cost值還一種是經過配置防火牆來動態的修改OSPF的cost值。


修改前的路由表

wKioL1cDiGqyQwwHAABhlSvof-0131.png

經過修改防火牆的配置來動態調整cost值


在FW1和FW2上分別加入這條命令

HRP_M[FW1]hrp ospf-cost adjust-enable   //動態調整OSPF值,默認狀況下備用設備的COST值將自動修改成65500


修改後的路由表

wKiom1cDi6_Q_JdWAABmf1HL-4c176.png

會發現全部到R2的流量都走FW1走,到FW2的流量cost都爲65501


流量測試

C1 ping C2

wKiom1cDhfai0yTrAABlxGd2dU4207.png


流量倒換測試

wKiom1cDhlPg9rs3AAAlQl6en8w612.png


關閉FW1上行口

wKiom1cDjUPwYBeYAAAPgPaP6GE157.png


wKioL1cDjgqB63b0AAAirSGiy7I370.png


會發現丟了一個包後業務恢復正常


總結:和上下行鏈接交換機相比,網關不用在作在防火牆上了,防火牆上只是作了一個會話的快速備份。

相關文章
相關標籤/搜索