USG作為校園或大型企業出口網關可以實現內網用戶通過兩個運營商訪問Internet,並保護內網不受網絡攻擊。
組網需求
某學校網絡通過USG連接到Internet,校內組網情況如下:
-
校內用戶主要分布在教學樓和宿舍區,通過匯聚交換機連接到USG。
-
學校分別通過兩個不同運營商(ISP1和ISP2)連接到Internet,兩個運營商分別為該校分配了4個IP地址。ISP1分配的IP地址是200.1.1.1~200.1.1.4,ISP2分配的IP地址是234.1.1.1~234.1.1.4,掩碼均為24位。
該學校網絡需要實現以下需求:
- 校內用戶能夠通過兩個運營商訪問Internet,且去往不同運營商的流量由USG上連接該運營商的對應的接口轉發。
- 當通往兩個運營商鏈路都正常工作的情況下,宿舍區用戶通過運營商ISP1訪問Internet,教學樓用戶通過運營商ISP2訪問Internet。
- 當一條鏈路出現故障時,流量可以被及時切換到另一條鏈路上,避免網絡長時間中斷。
- 保護內部網絡不受SYN Flood、UDP Flood和ICMP Flood的攻擊。
圖1 出口網關雙鏈路接入不同運營商舉例二組網圖
接口號:GigabitEthernet 0/0/1 校內用戶分配到網段為10.1.0.0/16的私網地址,部署在Trust區域。
IP地址:10.1.1.1/16
安全區域:Trust
接口號:GigabitEthernet 0/0/2 連接ISP1的接口,去往ISP1所屬網段的數據通過此接口轉發。
IP地址:200.1.1.1/24
安全區域:ISP1
安全優先級:15
接口號:GigabitEthernet 0/0/3 連接ISP2的接口。去往ISP2所屬網段的數據通過接口此接口轉發。
IP地址:234.1.1.1/24
安全區域:ISP2
安全優先級:20
IP地址:200.1.1.4/24 ISP1端與USG相連的接口。
IP地址:234.1.1.4/24 ISP2端與USG相連的接口。
ISP1分配給學校的IP地址 200.1.1.1~200.1.1.3,掩碼24位。
其中200.1.1.1用作USG的出接口地址,200.1.1.2和200.1.1.3用作Trust-ISP1域間的NAT地址池1的地址。
ISP2分配給學校的IP地址 234.1.1.1~234.1.1.3,掩碼24位。
其中234.1.1.1用作USG的出接口地址,234.1.1.2和234.1.1.3用作Trust-ISP2域間的NAT地址池2的地址。
配置思路
-
為了實現校園網內多個用戶使用有限公網IP地址接入Internet,需要配置NAPT方式的NAT,借助端口將多個私網IP地址轉換為有限的公網IP地址。
由於校園網連接兩個運營商,因此需要分別進行地址轉換,將私網地址轉換為公網地址。即創建兩個安全區域ISP1和ISP2,並分別在Trust-ISP1域間、Trust-ISP2域間配置NAT策略。
-
為了實現去往不同運營商的流量由對應接口轉發,需要收集ISP1和ISP2所屬網段的信息,並配置到這些網段的靜態路由。使去往ISP1的流量通過連接ISP1的接口轉發,去往ISP2的流量通過連接ISP2的接口轉發。
-
為了實現宿舍區用戶通過運營商ISP1訪問Internet,教學樓用戶通過運營商ISP2訪問Internet,需要配置策略路由。
-
為了提高鏈路的可靠性,避免業務中斷,即當一條鏈路出現故障時,流量可以被及時切換到另一條鏈路上,需要配置IP-Link和兩條優先級相同的默認路由。
-
在USG上啟用攻擊防范功能,保護校園網內部網絡。
操作步驟
1.配置USG各接口的IP地址並將接口加入安全區域。
# 配置USG各接口的IP地址。
<USG> system-view
[USG] interface GigabitEthernet 0/0/1 [USG-GigabitEthernet0/0/1] ip address 10.1.1.1 16 [USG-GigabitEthernet0/0/1] quit [USG] interface GigabitEthernet 0/0/2 [USG-GigabitEthernet0/0/2] ip address 200.1.1.1 24 [USG-GigabitEthernet0/0/2] quit [USG] interface GigabitEthernet 0/0/3 [USG-GigabitEthernet5/0/0] ip address 234.1.1.1 24 [USG-GigabitEthernet5/0/0] quit
# 將GigabitEthernet 0/0/1接口加入Trust安全區域
[USG] firewall zone trust
[USG-zone-trust] add interface GigabitEthernet 0/0/1 [USG-zone-trust] quit
# 創建安全區域ISP1,並將GigabitEthernet 0/0/2接口加入ISP1。
[USG] firewall zone name isp1
[USG-zone-isp1] set priority 15 [USG-zone-isp1] add interface GigabitEthernet 0/0/2 [USG-zone-isp1] quit
# 創建安全區域ISP2,並將GigabitEthernet 0/0/3接口加入ISP2。
[USG] firewall zone name isp2
[USG-zone-isp2] set priority 20 [USG-zone-isp2] add interface GigabitEthernet 0/0/3 [USG-zone-isp2] quit
2.配置域間包過濾及ASPF功能,對校內外數據流進行訪問控制。
# 配置Trust-ISP1的域間包過濾,允許校內用戶訪問ISP1。
[USG] policy interzone trust isp1 outbound [USG-policy-interzone-trust-isp1-outbound] policy 1 [USG-policy-interzone-trust-isp1-outbound-1] policy source 10.1.0.0 0.0.255.255 [USG-policy-interzone-trust-isp1-outbound-1] action permit [USG-policy-interzone-trust-isp1-outbound-1] quit [USG-policy-interzone-trust-isp1-outbound] quit
# 配置Trust-ISP2的域間包過濾,允許校內用戶訪問ISP2。
[USG] policy interzone trust isp2 outbound [USG-policy-interzone-trust-isp2-outbound] policy 1 [USG-policy-interzone-trust-isp2-outbound-1] policy source 10.1.0.0 0.0.255.255 [USG-policy-interzone-trust-isp2-outbound-1] action permit [USG-policy-interzone-trust-isp2-outbound-1] quit [USG-policy-interzone-trust-isp2-outbound] quit
# 在域間開啟ASPF功能,防止多通道協議無法建立連接。
[USG] firewall interzone trust isp1 [USG-interzone-trust-isp1] detect ftp [USG-interzone-trust-isp1] detect qq [USG-interzone-trust-isp1] detect msn [USG-interzone-trust-isp1] quit [USG] firewall interzone trust isp2 [USG-interzone-trust-isp2] detect ftp [USG-interzone-trust-isp2] detect qq [USG-interzone-trust-isp2] detect msn [USG-interzone-trust-isp2] quit
3.配置NAT策略,使內網用戶通過轉換后的公網IP地址訪問Internet。
# 配置應用於Trust-ISP1域間的NAT地址池1。地址池1包括ISP1提供的兩個IP地址200.1.1.2和200.1.1.3。
[USG] nat address-group 1 200.1.1.2 200.1.1.3
# 配置應用於Trust-ISP2域間的NAT地址池2。地址池2包括ISP2提供的兩個IP地址234.1.1.2和234.1.1.3。
[USG] nat address-group 2 234.1.1.2 234.1.1.3
# 在Trust-ISP1域間配置NAT策略,將校內用戶的私網IP地址轉換為ISP1提供的公網IP地址。
[USG] nat-policy interzone trust isp1 outbound [USG-nat-policy-interzone-trust-isp1-outbound] policy 1 [USG-nat-policy-interzone-trust-isp1-outbound-1] policy source 10.1.0.0 0.0.255.255 [USG-nat-policy-interzone-trust-isp1-outbound-1] action source-nat [USG-nat-policy-interzone-trust-isp1-outbound-1] address-group 1 [USG-nat-policy-interzone-trust-isp1-outbound-1] quit [USG-nat-policy-interzone-trust-isp1-outbound] quit
# 在Trust-ISP2域間配置NAT策略,將校內用戶的私網IP地址轉換為ISP2提供的公網IP地址。
[USG] nat-policy interzone trust isp2 outbound [USG-nat-policy-interzone-trust-isp2-outbound] policy 1 [USG-nat-policy-interzone-trust-isp2-outbound-1] policy source 10.1.0.0 0.0.255.255 [USG-nat-policy-interzone-trust-isp2-outbound-1] action source-nat [USG-nat-policy-interzone-trust-isp2-outbound-1] address-group 2 [USG-nat-policy-interzone-trust-isp2-outbound-1] quit [USG-nat-policy-interzone-trust-isp2-outbound] quit
4.配置IP-Link、多條靜態路由和兩條缺省路由,實現網絡的雙出口特性和鏈路的可靠性。
配置鏈路可達性檢查后,當發現該鏈路不可達時,則選擇另一條鏈路可達的路由。
# 配置IP-Link,並使用ICMP報文進行鏈路檢測。
[USG] ip-link check enable [USG] ip-link 1 destination 200.1.1.4 mode icmp [USG] ip-link 2 destination 234.1.1.4 mode icmp
# 配置兩條缺省路由並綁定IP-Link,當報文無法匹配靜態路由時,通過缺省路由發送給下一跳。
[USG] ip route-static 0.0.0.0 0.0.0.0 GigabitEthernet 0/0/2 200.1.1.4 track ip-link 1 [USG] ip route-static 0.0.0.0 0.0.0.0 GigabitEthernet 0/0/3 234.1.1.4 track ip-link 2
5.配置策略路由功能,使來自宿舍區用戶(10.1.1.2~10.1.1.100)和教學樓用戶(10.1.1.101~10.1.1.254)訪問Internet的報文分別通過不同接口轉發。
a.配置流分類。
# 創建地址集ispa和ispb,分別包括訪問Internet的報文默認由ISP1鏈路轉發和由ISP2鏈路轉發的源地址段。
[USG] ip address-set ispa type object [USG-object-address-set-ispa] address range 10.1.1.2 10.1.1.100 [USG-object-address-set-ispa] quit [USG] ip address-set ispb type object [USG-object-address-set-ispb] address range 10.1.1.101 10.1.1.254 [USG-object-address-set-ispb] quit
# 創建ACL 3001和3002,分別允許源地址集ispa和ispb。
[USG] acl 3001 [USG-acl-adv-3001] rule permit ip source address-set ispa [USG-acl-adv-3001] quit [USG] acl 3002 [USG-acl-adv-3002] rule permit ip source address-set ispb [USG-acl-adv-3002] quit
b.定義5號節點和10號節點,使地址集ispa中的源地址訪問Internet下一跳地址為200.1.1.4,地址集ispb中的源地址訪問Internet下一跳地址為234.1.1.4
[USG] policy-based-route test permit node 5 [USG-policy-based-route-test-5] if-match acl 3001 [USG-policy-based-route-test-5] apply ip-address next-hop 200.1.1.4 [USG-policy-based-route-test-5] quit [USG] policy-based-route test permit node 10 [USG-policy-based-route-test-10] if-match acl 3002 [USG-policy-based-route-test-10] apply ip-address next-hop 234.1.1.4 [USG-policy-based-route-test-10] quit
c.在接口GigabitEthernet 0/0/1中應用策略路由。
[USG] interface GigabitEthernet 0/0/1 [USG-GigabitEthernet0/0/1] ip policy-based-route test [USG-GigabitEthernet0/0/1] quit
6.配置攻擊防范功能,保護校園網絡。
請根據網絡實際情況開啟攻擊防范功能和調整報文速率閾值,本例中配置的攻擊防范功能僅供參考。
# 開SYN Flood、UDP Flood和ICMP Flood攻擊防范功能,並限制每條會話允許通過的ICMP報文最大速率為5包/秒。
[USG] firewall defend syn-flood enable [USG] firewall defend udp-flood enable [USG] firewall defend icmp-flood enable [USG] firewall defend icmp-flood base-session max-rate 5
結果驗證
1.執行命令display nat address-group,可以看到配置的NAT地址池信息。
[USG] display nat address-group NAT address-group information: number : 1 name : --- startaddr : 200.1.1.2 endaddr : 200.1.1.3 reference : 0 vrrp : --- vpninstance : public number : 2 name : --- startaddr : 234.1.1.2 endaddr : 234.1.1.3 reference : 0 vrrp : --- vpninstance : public Total 2 address-groups
2.在雙鏈路均可達的情況下,來自宿舍區的用戶訪問Internet報文經USG轉發后應全部流入鏈路ISP1,來自教學樓的用戶訪問Internet報文經USG轉發后應全部流入鏈路ISP2。
# 執行命令display ip-link,應查看到IP-Link狀態均為Up。
[USG] display ip-link num state timer vpn-instance ip-address interface-name mode vgmp next -hop 1 up 3 200.1.1.4 icmp none 2 up 3 234.1.1.4 icmp none
3.在其中一條故障的情況下,USG應查找備份路由,將報文轉發到另一條鏈路上。以當鏈路ISP1出現故障時為例進行說明。來自宿舍區的用戶訪問Internet報文經USG轉發后全部流入鏈路ISP2。
# 執行命令display ip-link,應查看到通往ISP2鏈路狀態均為Up,通往ISP1鏈路狀態為Down。
[USG] display ip-link num state timer vpn-instance ip-address interface-name mode vgmp next -hop 1 down 3 200.1.1.4 icmp none 2 up 3 234.1.1.4 icmp none
4.通過在網絡中操作,檢查業務是否能夠正常實現。
# 在宿舍區內的一台主機上,訪問ISP1所屬網段的一台服務器(IP地址為200.1.2.3),通過執行命令display firewall session table,可以看到私網IP地址轉換成了ISP1的公網IP地址。
[USG] display firewall session table Current Total Sessions : 1 http VPN: public -> public 10.1.2.2:1674[200.1.1.2:12889]-->200.1.2.3:80
# 在教學樓內的一台主機上,訪問ISP2所屬網段的一台服務器(IP地址為234.1.2.3),通過執行命令display firewall session table,可以看到私網IP地址轉換成了ISP2的公網IP地址。
[USG] display firewall session table Current Total Sessions : 1 http VPN: public -> public 10.1.2.2:1674[234.1.1.2:12889]-->234.1.2.3:80
5.執行命令display current-configuration | include firewall defend,可以檢查攻擊配置的防范功能。
配置腳本
USG配置腳本:
# nat address-group 1 200.1.1.2 200.1.1.3 nat address-group 2 234.1.1.2 234.1.1.3 # firewall defend icmp-flood enable firewall defend udp-flood enable firewall defend syn-flood enable firewall defend icmp-flood base-session max-rate 5 # interface GigabitEthernet0/0/1 ip address 10.1.1.1 255.255.0.0 # interface GigabitEthernet0/0/2 ip address 200.1.1.1 255.255.255.0 # interface GigabitEthernet0/0/3 ip address 234.1.1.1 255.255.255.0 # firewall zone local set priority 100 # firewall zone trust set priority 85 add interface GigabitEthernet0/0/1 # firewall zone untrust set priority 5 # firewall zone dmz set priority 50 # firewall zone name isp1 set priority 15 add interface GigabitEthernet0/0/2 # firewall zone name isp2 set priority 20 add interface GigabitEthernet0/0/3 # firewall interzone trust isp1 detect ftp detect qq detect msn # firewall interzone trust isp2 detect ftp detect qq detect msn # ip-link check enable ip-link 1 destination 200.1.1.4 ip-link 2 destination 234.1.1.4 # ip route-static 0.0.0.0 0.0.0.0 GigabitEthernet0/0/2 200.1.1.4 track ip-link 1 ip route-static 0.0.0.0 0.0.0.0 GigabitEthernet0/0/3 234.1.1.4 track ip-link 2 # interface GigabitEthernet0/0/1 ip address 10.1.1.1 255.255.255.0 ip policy-based-route test # acl number 3001 rule 5 permit ip source address-set ispa # acl number 3002 rule 5 permit ip source address-set ispb # policy-based-route test permit node 5 if-match acl 3001 apply ip-address next-hop 200.1.1.10 policy-based-route test permit node 10 if-match acl 3002 apply ip-address next-hop 234.1.1.10 # ip address-set ispa type object address 0 range 10.1.1.2 10.1.1.100 # ip address-set ispb type object address 0 range 10.1.1.101 10.1.1.254 # policy interzone trust isp1 outbound policy 1 action permit policy source 10.1.0.0 0.0.255.255 # policy interzone trust isp2 outbound policy 1 action permit policy source 10.1.0.0 0.0.255.255 # nat-policy interzone trust isp1 outbound policy 1 action source-nat policy source 10.1.0.0 0.0.255.255 address-group 1 # nat-policy interzone trust isp2 outbound policy 1 action source-nat policy source 10.1.0.0 0.0.255.255 address-group 2 # return