華爲防火牆


防火牆默認的管理接口g0/0/0默認的ip地址爲192.168.0.1/24默認g0/0/0接口開啓了dhcp server,默認用戶名爲admin,默認密碼爲Admin@123

一、 配置案例

1.1 拓撲圖

wKioL1kQD5uzR7LpAABuMh7DS5Y740.png-wh_50

GE 0/0/1:10.10.10.1/24
GE 0/0/2:220.10.10.16/24
GE 0/0/3:10.10.11.1/24
WWW服務器:10.10.11.2/24(DMZ區域)
FTP服務器:10.10.11.3/24(DMZ區域)

1.2 Telnet配置

配置VTY 的優先級爲3基於密碼驗證。

# 進入系統視圖。

<USG5300> system-view

# 進入用戶界面視圖

[USG5300] user-interface vty 0 4

# 設置用戶界面能夠訪問的命令級別爲level 3

[USG5300-ui-vty0-4] user privilege level 3

配置Password驗證

# 配置驗證方式爲Password驗證

[USG5300-ui-vty0-4] authentication-mode password

# 配置驗證密碼爲lantian

[USG5300-ui-vty0-4] set authentication password simple lantian  ###最新版本命令是authentication-mode password cipher huawei@123

配置空閒斷開連接時間

# 設置超時爲30分鐘

[USG5300-ui-vty0-4] idle-timeout 30

[USG5300] firewall packet-filter default permit interzone untrust local direction inbound //加這個從公網不能telnet防火牆。

基於用戶名和密碼驗證

user-interface vty 0 4

 authentication-mode aaa

aaa

 local-user admin password cipher ]MQ;4\]B+4Z,YWX*NZ55OA!!

 local-user admin service-type telnet

 local-user admin level 3

firewall packet-filter default permit interzone untrust local direction inbound

如果不開放trust域到local域的缺省包過濾,那麼內網也不能telnet的防火牆,但是默認情況下已經開放了trust域到local域的缺省包過濾

 

1.3 地址配置

內網:

進入GigabitEthernet 0/0/1視圖

[USG5300] interface GigabitEthernet 0/0/1

配置GigabitEthernet 0/0/1IP地址
[USG5300-GigabitEthernet0/0/1] ip address 10.10.10.1 255.255.255.0

配置GigabitEthernet 0/0/1加入Trust區域

[USG5300] firewall zone trust

[USG5300-zone-untrust] add interface GigabitEthernet 0/0/1

[USG5300-zone-untrust] quit

外網:

進入GigabitEthernet 0/0/2視圖

[USG5300] interface GigabitEthernet 0/0/2

配置GigabitEthernet 0/0/2IP地址

[USG5300-GigabitEthernet0/0/2] ip address 220.10.10.16  255.255.255.0

配置GigabitEthernet 0/0/2加入Untrust區域

[USG5300] firewall zone untrust

[USG5300-zone-untrust] add interface GigabitEthernet 0/0/2

[USG5300-zone-untrust] quit

DMZ

進入GigabitEthernet 0/0/3視圖

[USG5300] interface GigabitEthernet 0/0/3

配置GigabitEthernet 0/0/3IP地址。

[USG5300-GigabitEthernet0/0/3] ip address 10.10.11.1  255.255.255.0

[USG5300] firewall zone dmz

[USG5300-zone-untrust] add interface GigabitEthernet 0/0/3

[USG5300-zone-untrust] quit

1.4 防火牆策略

本地策略是指與Local安全區域有關的域間安全策略,用於控制外界與設備本身的互訪。

間安全策略就是指不的區域之間的安全策略。

域內安全策略就是指同一個安全區域之間的策略,缺省情況下,同一安全區域內的數據流都允許通過,域內安全策略沒有InboundOutbound方向的區分。

策略內按照policy的順序進行匹配,如果policy 0匹配了,就不會檢測policy 1,policyID大小沒有關係,誰在前就先匹配誰。

缺省情況下開放local域到其他任意安全區域缺省包過濾,方便設備自身的對外訪問。其他接口都沒有加安全區域,並且其他域的缺省包過濾關閉。要想設備轉發流量必須將接口加入安全區域,並配置域間安全策略或開放缺省包過濾。

安全策略的匹配順序










 

 

wKiom1kQD0eTDCZ8AAFcy5KNOA8285.png-wh_50


每條安全策略中包括匹配條件、控制動作和UTM等高級安全策略。

匹配條件

安全策略可以指定多種匹配條件,報文必須同時滿足所有條件纔會匹配上策略。

比如如下策略

policy 1

  policy service service-set dns

policy destination 221.2.219.123 0

policy source 192.168.10.1

在這裏policy service的端口53就是指的是221.2.219.12353端口,可以說是目的地址的53端口

域間可以應用多條安全策略,按照策略列表的順序從上到下匹配。只要匹配到一條策略就不再繼續匹配剩下的策略。如果安全策略不是以自動排序方式配置的,策略的優先級按照配置順序進行排列,越先配置的策略,優先級越高,越先匹配報文。但是也可以手工調整策略之間的優先級。缺省情況下,安全策略就不是以自動排序方式如果安全策略是以自動排序方式配置的,策略的優先級按照策略ID的大小進行排列,策略ID越小,優先級越高,越先匹配報文。此時,策略之間的優先級關係不可調整。policy create-mode auto-sort enable命令用來開啓安全策略自動排序功能,默認是關閉的。

如果沒有匹配到安全策略,將按缺省包過濾的動作進行處理,所以在配置具體安全策略時要注意與缺省包過濾的關係。例如安全策略中只允許某些報文通過但是沒有關閉缺省包過濾,將造成那些沒有匹配到安全策略的流量也會通過,就失去配置安全策略的意義了。

同樣,如果安全策略中只配置了需要拒絕的流量,其他流量都是允許通過的,這時需要開放缺省包過濾才能實現需求,否則會造成所有流量都不能通過。

執行命令display this查看當前已有的安全策略,策略顯示的順序就是策略的匹配順序,越前邊的優先級越高

執行命令policy move policy-id1 { before | after } policy-id2,調整策略優先級。

UTM策略

安全策略中除了基本的包過濾功能,還可以引用IPSAV、應用控制等UTM策略進行進一步的應用層檢測。但前提是匹配到控制動作爲permit的流量才能進行UTM處理,如果匹配到deny直接丟棄報文。

安全策略的應用方向

域間的InboundOutbound方向上都可以應用安全策略,需要根據會話的方向合理應用。因爲USG是基於會話的安全策略,只對同一會話的首包檢測,後續包直接按照首包的動作進行處理。所以對同一條會話來說只需要在首包的發起方向上,也就是訪問發起的方向上應用安全策略。

wKioL1kQD7TxYWyGAAB4m2AsbXM404.png-wh_50

上圖所示,Trust域的PC訪問Untrust域的Server,只需要在TrustUntrustOutbound方向上應用安全策略允許PC訪問Server即可,對於Server迴應PC的應答報文會命中首包建立的會話而允許通過。

1.4.1 Trust和Untrust域間允許內網用戶訪問公網

策略一般都是優先級高的在前,優先級低的在後。

policy 1:允許源地址爲10.10.10.0/24的網段的報文通過

配置TrustUntrust域間出方向的防火牆策略。  //如果不加policy source就是any,如果不加policy destination目的地址就是any

[USG5300] policy interzone trust untrust outbound

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

[USG5300-policy-interzone-trust-untrust-outbound-1] policy source 10.10.10.0 0.0.0.255 

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

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

如果是允許所有的內網地址上公網可以用以下命令:

[USG2100]firewall packet-filter default permit interzone trust untrust direction outbound  //必須添加這條命令,或者firewall packet-filter default permit all,但是這樣不安全。否則內網不能訪問公網。

注意:由優先級高訪問優先級低的區域用outbound,比如policy interzone trust untrust outbound這時候policy source ip地址,就是指的優先級高的地址,即trust地址,destination地址就是指的untrust地址。只要是outbound,即使配置成policy interzone untrust trust outbound也會變成policy interzone trust untrust outbound

由優先級低的區域訪問優先級高的區域用inbound,比如是policy interzone untrust trust inbound,爲了保持優先級高的區域在前,優先級低的區域在後,命令會自動變成policy interzone trust untrust inbound這時候policy source ip地址,就是指的優先級低的地址,即untrust地址,destination地址就是指的優先級高的地址,即trust地址。

總結outbount時,source地址爲優先級高的地址,destination地址爲優先級低的地址。inbount時,source地址爲優先級低的地址destination地址爲優先級的地址

配置完成後可以使用display policy interzone trust untrust來查看策略。

1.4.2 DMZUntrust域間:從公網訪問內部服務器

policy 2:允許目的地址爲10.10.11.2,目的端口爲21的報文通過

policy 3:允許目的地址爲10.10.11.3,目的端口爲8080的報文通過

配置UntrustDMZ域間入方向的防火牆策略,公網訪問內網服務器

只需要允許訪問內網ip地址即可,不需要配置訪問公網的ip地址。

注意在域間策略裏匹配的順序和policy的數字沒有關係,他是從前往後檢查,如果前一個匹配就不檢查下一條了,假如先寫的policy 3後寫的policy 2,那麼就先執行policy 3裏的語句,如果policy 3裏和policy 2裏有相同的地址,只要上一個匹配了就不執行下一個一樣的地址了。

舉例說明:policy 2裏允許192.168.0.1通過,policy 3裏拒絕192.168.0.1通過,哪個policy先寫的就執行哪個。

[USG5300] policy interzone untrust dmz inbound

[USG5300-policy-interzone-dmz-untrust-inbound] policy 2

[USG5300-policy-interzone-dmz-untrust-inbound-2] policy destination 10.10.11.3 0

[USG5300-policy-interzone-dmz-untrust-inbound-2] policy service service-set ftp

[USG5300-policy-interzone-dmz-untrust-inbound-2] action permit

[USG5300-policy-interzone-dmz-untrust-inbound-2] quit

[USG5300-policy-interzone-dmz-untrust-inbound] policy 3

[USG5300-policy-interzone-dmz-untrust-inbound-3] policy destination 10.10.11.2 0

[USG5300-policy-interzone-dmz-untrust-inbound-3] policy service service-set http

[USG5300-policy-interzone-dmz-untrust-inbound-3] action permit

[USG5300-policy-interzone-dmz-untrust-inbound-3] quit

[USG5300-policy-interzone-dmz-untrust-inbound] quit

 

應用FTPNAT ALG功能。

[USG5300] firewall interzone dmz untrust   ###優先級高的區域在前
[USG5300-interzone-dmz-untrust] detect ftp
[USG5300-interzone-dmz-untrust] quit
USG5300支持FTPHTTPH.323HWCCICQMSNPPTPQQRTSPSIPMGCPSQL.NETNETBIOSMMS等協議的會話時,需要在域間啓動ALG功能

配置NAT ALG功能與配置應用層包過濾(ASPF)功能使用的是同一條命令。所以如果已經在域間配置過ASPF功能的話,可以不需要再重複配置NAT ALG功能。

兩者的區別在於:

ASPF功能的目的是識別多通道協議,並自動爲其開放相應的包過濾策略。

NAT ALG功能的目的是識別多通道協議,並自動轉換報文載荷中的IP地址和端口信息。

在域間執行detect命令,將同時開啓兩個功能。

 

配置內部服務器:

<USG5300> system-view

[USG5300] nat server protocol tcp global 220.10.10.16 8080 inside 10.10.11.2 www

[USG5300] nat server protocol tcp global 220.10.10.17 ftp inside 10.10.11.3 ftp

1.4.3 NAT策略

TrustUntrust域間  如果是同一個區域,比如trusttrust就是域內。

基於源IP地址轉換方向

Outbound方向:數據包從高安全級別流向低安全級別

Inbound方向:數據包從低安全級別流向高安全級別

高優先級與低優先級是相對的

根據基於源IP地址端口是否轉換分爲no-pat方式和napt方式

No-PAT方式:用於一對一IP地址轉換,不涉及端口轉換

NAPT方式:用於多對一或多對多IP地址轉換,涉及端口轉換

1通過地址池的方式

policy 1:允許網段爲10.10.10.0/24的內網用戶訪問Internet時進行源地址轉換,採用公網地址池的形式。

配置地址池

[USG5300]nat address-group 1 220.10.10.16 220.10.10.20

配置TrustUntrust域間出方向的策略

[USG5300] nat-policy interzone trust untrust outbound

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

[USG5300- nat-policy -interzone-trust-untrust-outbound-1] policy source 10.10.10.0 0.0.0.255

[USG5300- nat-policy -interzone-trust-untrust-outbound-1] action source-nat

[USG5300- nat -policy-interzone-trust-untrust-outbound-1] address-group 1 [no pat]

如果是基於外網接口的nat轉換可以不用配置地址池,直接在nat-policy interzone trust untrust outbound裏配置eary-ip 外網接口

這裏的policy source指的是trust地址,nat轉換成untrust地址,如果是nat-policy interzone trust untrust inbound,源地址就是指untrust地址,轉換成trust地址。

2通過公網接口的方式

創建Trust區域和Untrust區域之間的NAT策略,確定進行NAT轉換的源地址範圍192.168.1.0/24網段,並且將其與外網接口GigabitEthernet 0/0/4進行綁定。

[USG] nat-policy interzone trust untrust outbound

[USG-nat-policy-interzone-trust-untrust-outbound] policy 0

[USG-nat-policy-interzone-trust-untrust-outbound-0] policy source 192.168.1.0 0.0.0.255

[USG-nat-policy-interzone-trust-untrust-outbound-0] action source-nat

[USG-nat-policy-interzone-trust-untrust-outbound-0] easy-ip GigabitEthernet 0/0/4

[USG-nat-policy-interzone-trust-untrust-outbound-0] quit

3直接在接口啓用nat

如果是針對內網用戶上公網做nat,需要在內網接口使用

[USG-GigabitEthernet0/0/0]nat enable

、其他常用配置

2.1 查看防火牆的會話的命令

[USG5320]dis firewall session table [source|destination] [inside|global]可以查看這個數據包有沒有過來。

display firewall session table verbose source inside 2.2.2.2   //inside可以查看私網ip地址信息,global可以查看公網ip地址信息。

wKiom1kQD-uw9wggAAAi0J1pkhs329.png-wh_50

如上圖所示

icmp表示協議的類型

local --> trust 表示這個包是從local區域到trust區域的

192.168.200.5:1 --> 172.16.4.66:2048表示這個包是從192.168.200.5訪問172.16.4.66的,如果該會話項有[]就表示做了nat轉換,[]地址是轉換後的地址。如果該會話項爲“+->”表示啓用了ASPF;

-->packets:14 bytes:840表示該會話出方向的包數和字節數統計

<--packets:5 bytes:420 表示該會話入方向的包數和字節數統計。

 

wKioL1kQEAfwQeUDAAAkliYPHlg911.png-wh_50

上圖所示:“<--packets:0 bytes:0”表示回來的包沒有收到。

2.2 查看防火牆序列號

display firewall esn 可以查看防火牆的序列號

wKioL1kQEB7xlZd9AAAMGhsR3kY044.png-wh_50

 

 

2.3 DHCP配置

2.3.1 接口dhcp

用接口的DHCP功能 (在某個VLAN接口下啓用DHCP功能,這個VLAN裏的所有主機將自動獲得IP地址,網段就是接口IP的網段,網關爲接口IP

例:

[USG5300] dhcp enable  (啓用dhcp服務,缺省情況下啓用)
[USG5300] interface Vlan-interface2
[USG5300-Vlanif2] ip address 219.225.149.1 255.255.255.0
[USG5300-Vlanif2] dhcp select interface (啓用接口的DHCP功能)
[USG5300-Vlanif2] dhcp server static-bind ip-address 219.225.149.8 mac-address 00e0-4c58-0d26(做IPmac綁定, 對於一些特定的客戶端(例如WWW服務器)需要靜態分配固定IP地址,此時可以在DHCP服務器側綁定IP地址和特定客戶端MAC地址。
[USG5300-Vlanif2] dhcp server dns-list 219.225.128.6 219.225.159.6(指定DNS地址

[USG5300-Vlanif2] dhcp server ip-range 10.1.1.1 10.1.1.100  (配置接口地址池的IP地址範圍, 缺省情況下,接口地址池的地址範圍就是接口的IP地址所在的網段)

[USG5300] dhcp server forbidden-ip 10.110.1.1 10.110.1.63 (配置DHCP地址池中不參與自動分配的IP地址)

2.3.2全局DHCP功能

[USG5300] dhcp enable
[USG5300] dhcp server ip-pool 136 (定義一個全局的地址池,名子自己定義)
[USG5300-dhcp-136]network 219.225.136.0 mask 255.255.255.0(這個地址池可供分配的IP段)
[USG5300-dhcp-136]gateway-list 219.225.136.1(必須寫網關,否則自動分配的IP地址無網關)
[USG5300-dhcp-136]dns-list 219.225.128.6DNS配置)

[USG5300-dhcp-136] static-bind ip -address 10.1.1.1 mask 255.255.255.0

[USG5300-dhcp-136] static-bind mac-address 0000-e03f-0305
#
[USG5300]dhcp server ip-pool 149(定義一個全局的地址池,名子自己定義)
[USG5300-dhcp-149]network 219.225.149.0 mask 255.255.255.0(這個地址池可供分配的IP段)
[USG5300-dhcp-149]gateway-list 219.225.149.1(自動獲取的IP主機獲得的網關)
[USG5300-dhcp-149]dns-list 219.225.128.6DNS配置)

[USG5300]interface Vlan-interface2 (定義vlan接口,自由定義)
[USG5300-Vlanif2]dhcp select globle(接口上啓用dhcp select globle功能)
[USG5300-Vlanif2]ip address 219.225.136.1 255.255.255.0(vlan接口必須要分一個IP,即與網關相同的IP,系統根據接口IP與掩碼確定自動分配哪一個IP-PoolIP

[USG5300] interface Vlan-interface3 (定義vlan接口,自由定義)
[USG5300-Vlanif3]dhcp select globle(接口上啓用dhcp select globle功能)
[USG5300-Vlanif3]ip address 219.225.149.1 255.255.255.0(vlan接口必須要分一個IP,即與網關相同的IP,系統根據接口IP與掩碼確定自動分配哪一個IP-PoolIP

2.4 配置透明模式

目前華爲的防火牆不支持透明模式的命令,只能用Vlan,把端口加入到vlan方式。

[USG5300] vlan 2

[USG5300] int g0/0/0

[USG5300-GigabitEthernet0/0/0] portswitch

[USG5300-GigabitEthernet0/0/0] port link-type access

[USG5300-GigabitEthernet0/0/0] port access vlan 2

[USG5300] int g0/0/1

[USG5300-GigabitEthernet0/0/1]portswitch

[USG5300-GigabitEthernet0/0/1] port link-type access

[USG5300-GigabitEthernet0/0/1] port access vlan 2

然後把相應的端口加入到相應的區域就可以了!一般只需要加物理接口即可。

如果防火牆只是用在服務器和內網之間,一般將連接服務器接口設置爲trust,將內網設置爲untrust

子接口的配置方法:子接口不能配置portswitch命令,可以子接口劃分到某個vlan

[USG5300-GigabitEthernet0/0/3]int g0/0/3.1

[USG5300-GigabitEthernet0/0/3.1]vlan-type dot1q 60

設置GigabitEthernet 0/0/3.1VLAN ID 60相關聯,以太網子接口GigabitEthernet 0/0/3.1的封裝格式爲dot1q

2.5 配置時鐘

用戶模式下

<USG5300> clock timezone Beijing minus 08:00:00

<USG5300> clock datetime 0:0:0 2012/12/01

display clock可以查看時間

2.6 系統更新

2.6.1 使用命令進行升級

1、 將升級文件上傳到防火牆

<USG5300> tftp 192.168.0.100 get su5mpua07v3r1c00spc700.bin

2、 <USG5300> startup system-software USG5300V200R001C00SPC800.bin  ##指定下次啓動時使用的版本文件。

<USG5300> startup saved-configuration vrpcfg_new.cfg  ##指定下次啓動時使用的配置文件,這個是可選配置

3、 display startup   ###驗證配置

4、 使用reboot重啓防火牆,執行reboot命令後,設備將會顯示兩次提示信息,詢問是否繼續,請您不保存配置重新啓動。

5、 用戶模式命令如果license可以通過命令加載license。系統視圖命令:[USG5300]license file license.dat然後使用reboot命令重新啓動系統,重新啓動時請一定不要保存配置。

6、 加載補丁的方法:

1、在任意視圖下,執行display patch-information,查看補丁信息。


2、如果沒有補丁信息可以直接加載補丁;如果有補丁信息,需要先刪除原有補丁再加載,示例如下:

 [USG5300] patch delete V300R001C10SPH101.pat

3加載補丁:[USG5300] patch load V300R001C10SPH102.pat

4激活補丁[USG5300] patch active V300R001C10SPH102.pat

5、運行補丁[USG5300] patch run V300R001C10SPH102.pat

2.6.2 使用圖形界面升級

點擊維護系統更新

wKiom1kQEE3x0ifxAACXTdBjtkE335.png-wh_50

 

選擇需要更新的系統文件,點擊導入


 wKioL1kQEGai2K4qAAAgS1x82aM065.png-wh_50

使用圖形界面升級的時候,升級完成後不需要保存配置。直接重啓就是。

 

用圖形界面加載License的方法如下:選擇License文件,然後點擊激活。

wKiom1kQEHrRKOjwAABfo63jMxc910.png-wh_50

2.7 防火牆策略的配置

策略需求:

對於policy interzone trust dmz outbound之間的策略有以下需求:
1、源地址10.28.197.143訪問所有的目的地址,服務全部開放。
2、源地址是所有的,目的地址是192.168.1.5192.168.1.6192.168.1.7開放8080804433389端口。
3、源地址是所有的訪問目的地址是192.168.1.10192.168.1.11的服務全部開放。

這三個都要求開放icmp協議。

這裏源爲優先級高的10.28.197.X的trust,目的爲優先級低的192.168.1.X的dmz

如果策略裏不知道源和目的就是指any

配置方法:

ip service-set test1 type object        //創建自定義服務     

 service 0 protocol tcp destination-port 8080

 service 1 protocol tcp destination-port 3389

可以指定一個範圍,比如:

 service 1 protocol tcp destination-port 8080 to 8090

 

ip service-set test type group   //創建服務組,可以將創建的自定義服務或者預定義的服務加到服務組裏。

 service 0 service-set http

 service 1 service-set https

service 2 service-set icmp

service 3 service-set test1  //以上創建的自定義服務添加到服務組裏

 

policy interzone trust dmz outbound  //配置域間包過濾策略,3個需求3policy策略

 policy 0 

 action permit 

 policy source 10.28.197.143 mask 255.255.255.255

 policy 1 

 action permit 

 policy service service-set test     //指定上面創建的服務

 policy destination 192.168.1.5 mask 255.255.255.255

 policy destination 192.168.1.6 mask 255.255.255.255

 policy destination 192.168.1.7 mask 255.255.255.255

 policy 2 

 action permit 

 policy destination 192.168.1.10 mask 255.255.255.255

 policy destination 192.168.1.11 mask 255.255.255.255

#

有地方還需要創建地址,方法如下

ip address-set ap type object   //創建地址集:

 address 0 192.168.100.62 mask 32   //一個單獨地址

 address 1 range 18.0.6.55 18.0.6.255 //創建一個地址範圍

類型objectgroup格式是一樣的,只不過group地址裏可以包含object和其他的group

wKioL1kQEKfiuxo4AAAoZEN2uaQ486.png-wh_50

ip address-set 生產網ip限制 type group  //創建地址組

address 0 address-set ap                               //可以包含以前的object

 address 1 range 18.0.7.0 18.0.7.255

 address 2 range 18.0.6.55 18.0.6.255

 address 3 range 18.0.5.0 18.0.5.255

 address 4 range 18.0.4.0 18.0.4.255    //一個地址範圍,組裏可以包含以前創建的地址或者組。

添加地址界面

wKioL1kQEMPRqCKcAAAtBJDxztE663.png-wh_50

創建的地址集或者地址組需要在策略裏引用:

policy interzone trust dmz outbound

policy 1

policy destination address-set生產網ip限制

2.8 內部服務器映射

ip service-set video type object                 //增加自定義服務,做域間策略的時候引用

 service protocol tcp destination-port 10001 to 10007   //開啓端口的範圍

 service protocol tcp destination-port 9001

 service protocol tcp destination-port 3389

 service protocol tcp destination-port 1521

service protocol tcp destination-port 5060

service protocol udp destination-port 5060

ip service-set test_group type group             //增加自定義服務

 service 0 service-set http

 service 1 service-set telnet

 service 2 service-set video               //這個可以是自定義的服務

ip address-set address type object          //增加自定義IP地址

 address 192.168.5.123 0

 address 192.168.5.20 0

ip address-set test type group   //創建自定義IP地址組

address address-set address     //可以包含以前的地址object

address 192.168.5.123 0

 address range 18.0.7.0 18.0.7.255

 address range 18.0.6.55 18.0.6.255

 address range 18.0.5.0 18.0.5.255

policy interzone untrust dmz inbound

 policy 1

 action permit

 policy destination address-set test

policy service service-set icmp

 policy service service-set http

 policy service service-set video

nat server protocol udp global 218.84.3.174 5060 inside 192.168.5.123 5060

nat server protocol tcp global 218.84.3.174 5060 inside 192.168.5.123 5060

nat server protocol tcp global 218.84.3.174 10002 inside 192.168.5.123 10002

nat server protocol tcp global 218.84.3.174 10003 inside 192.168.5.123 10003

nat server protocol tcp global 218.84.3.174 10004 inside 192.168.5.123 10004

nat server protocol tcp global 218.84.3.174 10005 inside 192.168.5.123 10005

nat server protocol tcp global 218.84.3.174 10006 inside 192.168.5.123 10006

nat server protocol tcp global 218.84.3.174 10007 inside 192.168.5.123 10007

nat server protocol tcp global 218.84.3.174 80 inside 192.168.5.20 80

查看dis policy interzone

    Dis nat-policy

 

2.9 配置域內NAT,實現內網用戶通過公網訪問內部服務器

1、針對全局trust區域配置了nat server

nat address-group 1 192.168.0.1 192.168.0.1   比如防火牆trust接口地址爲192.168.0.1地址池的地址無所謂,即使配置一個防火牆上不存在的地址也無所謂一般爲了直觀都用接口的ip地址。

#

nat server zone trust protocol tcp global 218.84.3.174 8090 inside 192.168.5.198 8080  //這個可以不用配置,直接用全局的也行,即不帶zone的。這條必要配置

#

nat-policy zone trust

 policy 0

  action source-nat

  policy source 192.168.5.0 0.0.0.255   //內網網段可以不用指定,不指定代表any

  policy destination 192.168.1.123 0    //內部服務器可以不用指定,不指定代表any

  policy destination 192.168.1.198 0    //內部服務器,可以不用指定,不指定代表any

  address-group 1

#

ip route-static 192.168.0.1 32 NULL 0    //配置黑洞路由,避免形成路由環路,也可以不用配置,不正常的時候在配置。

2針對全局dmz區域配置了nat server,但是trust區域訪問dmz內部服務器映射後的公網地址的配置。

nat address-group 2 172.18.200.250 172.18.200.250  //比如dmz接口的地址是172.18.200.250

nat-policy interzone trust dmz outbound

policy 0

  action source-nat

  address-group 2

如果要是想實現dmz通過trust映射後的地址訪問內部服務器可以用以下命令

nat address-group 3 172.18.200.251 172.18.200.251  

nat-policy interzone dmz trust inbound

policy 0

  action source-nat

  address-group 3

 

2.10 配置策略路由

配置要求10.10.167.0218.201.135.17710.10.168.058.57.15.53

1、創建acl

acl number 3000

 rule 1 permit ip source 10.10.167.0 0.0.0.255

acl number 3001

 rule 1 permit ip source 10.10.168.0 0.0.0.255

 

2、創建策略路由

policy-based-route internet permit node 0

  if-match acl 3000

  apply ip-address next-hop 218.201.135.177

policy-based-route internet permit node 1

  if-match acl 3001

  apply ip-address next-hop 58.57.15.53

 

3、將策略路由引用到入接口(內網口)

 ip policy-based-route internet

 

4、配置默認路由,配置策略路由時候不需要配置明細路由。

 ip route-static 0.0.0.0 0.0.0.0 218.201.135.177

 ip route-static 0.0.0.0 0.0.0.0 58.57.15.53

 

檢查配置:

dis policy-based-route

2.11雙線接入時的路由配置


雙線接入時必須選擇等價路由配置到達相同目的地的多條路由,如果指定相同優先級,則可實現負載分擔。此時,多條路由之間稱爲等價路由。

load-balance flow命令用來配置IP報文逐流負載分擔。主要destination-ip destination-port  source-ip |source-port 相當於等價路由。

 


firewall packet-filter default permit interzone local trust direction inbound      //允許pingtrust,允許telnet trust接口,使能夠訪問trust接口,如果不加這條命令不能防火牆上pingtrust也不能telnet trust接口。所有的local與業務無關。

firewall packet-filter default permit interzone local trust direction outbound

firewall packet-filter default permit interzone local untrust direction inbound

firewall packet-filter default permit interzone local untrust direction outbound

firewall packet-filter default permit interzone local dmz direction inbound

firewall packet-filter default permit interzone local dmz direction outbound

 

 

配置內部服務器

V3版本通過acl指定,v5版本通過域間策略指定。

拓撲:Internet------USG2000------WEB服務器

要求:服務器及其內網通過NAT能訪問Internet,服務器80端口對外發佈網頁

配置:

.NAT

acl number 2000
   rule 10 permit source 192.168.0.0 0.0.0.255

nat address-group 1 218.1.1.1 218.1.1.1

firewall interzone trust untrust
packet-filter 2000 outbound
   nat outbound 2000 address-group 1

2.外網訪問服務器

acl number 3000
 rule 10 permit tcp destination 192.168.0.2 0 destination-port eq www

nat server protocol tcp global 218.1.1.1 www inside 192.168.0.2 www

firewall interzone trust untrust
packet-filter 3000 inbound

3.配置telnet

acl number 3002
 rule 10 permit ip destination 218.1.1.1 0

user-interface vty 0 4
 acl 3002 inbound

當內網部署了一臺服務器,其真實IP是私網地址,但是希望公網用戶可以通過一個公網地址來訪問該服務器,這時可以配置NAT Server,使設備將公網用戶訪問該公網地址的報文自動轉發給內網服務器。

前提條件

· 已經配置USG5300的工作模式(只能爲路由模式,混合模式也是可以的)

· 已經配置接口IP地址

· 已經配置接口加入安全區域

· (可選)如果使用虛擬防火牆功能,需要已經創建***實例,並配置接口綁定***實例


spacer.gif說明:

當針對同一私網IP地址配置了NAT和內部服務器兩個功能時,USG5300將優先根據內部服務器功能的配置進行地址轉換。

操作步驟

1. 執行命令system-view,進入系統視圖。

2. 選擇執行以下命令之一,配置內部服務器。

對所有安全區域發佈同一個公網IP,即這些安全區域的用戶都可以通過訪問同一個公網IP來訪問內部服務器。



配置舉例

當一個內部服務器需要對不同網段的外部用戶提供服務時,多次執行帶no-reverse參數的nat server命令,可以爲一個內部服務器配置多個公網IP地址。此時,外部的不同網段用戶可以通過訪問不同的公網IP地址來訪問此內部服務器。

1所示,例如服務器內部IP地址爲1.1.1.1,其公網IP地址分別爲2.2.2.2和3.3.3.3。



[USG5300] nat server protocol tcp global 2.2.2.2 ftp inside 1.1.1.1 ftp no-reverse

[USG5300] nat server protocol tcp global 3.3.3.3 ftp inside 1.1.1.1 ftp no-reverse

spacer.gif說明:

兩次使用帶no-reverse參數的nat server命令,爲該內部服務器配置兩個外部IP地址。

[USG5300] nat address-group 0 2.2.2.2 2.2.2.2

[USG5300] nat address-group 1 3.3.3.3 3.3.3.3

spacer.gif注意:

需要爲不同的公網IP地址配置各自所屬的不同的地址池。

[USG5300] nat-policy interzone dmz untrust outbound

[USG5300-nat-policy-interzone-dmz-untrust-outbound] policy 0

[USG5300-nat-policy-interzone-dmz-untrust-outbound-0] policy source 1.1.1.1 0

[USG5300-nat-policy-interzone-dmz-untrust-outbound-0] policy destination 2.0.0.0 mask 8

[USG5300-nat-policy-interzone-dmz-untrust-outbound-0] action source-nat

[USG5300-nat-policy-interzone-dmz-untrust-outbound-0] address-group 0

[USG5300-nat-policy-interzone-dmz-untrust-outbound-0] quit

[USG5300-nat-policy-interzone-dmz-untrust-outbound] policy 1

[USG5300-nat-policy-interzone-dmz-untrust-outbound-1] policy source 1.1.1.1 0

[USG5300-nat-policy-interzone-dmz-untrust-outbound-1] policy destination 3.0.0.0 mask 8

[USG5300-nat-policy-interzone-dmz-untrust-outbound-1] action source-nat

[USG5300-nat-policy-interzone-dmz-untrust-outbound-1] address-group 1

允許內部服務器訪問外部不同網段的用戶羣或不同的安全區域時,需要配置不同的目的地址,使該內部服務器通過不同的公網IP地址訪問。

內部服務器訪問2.0.0.0/24網段時,內部服務器私網的IP地址轉換爲地址池0中的公網IP地址2.2.2.2。內部服務器訪問3.0.0.0/24網段時,內部服務器私網的地址轉換成地址池1中的公網IP地址3.3.3.3。由此可以配置內部服務器與用戶羣之間能相互訪問。

 

 

 

 

 

 

 

 

 

1命令行配置方式:

配置整體限流策略,限制上網的總體最大上傳/下載帶寬均爲100Mbps

整體上傳限流

traffic-policy enable   //啓用限流功能

#

car-class upload_class type shared   //配置整體限流Class名稱爲upload_class

 connection-number 2000  //限制連接數上限爲2000一般上傳不限制連接數。

 car 10000         //限制最大帶寬爲100Mbps,單位爲kbps1Mbps1000kbps

#

 

//創建上傳的限流策略,上傳的方向是從TrustUntrust

traffic-policy interzone trust untrust outbound shared

  policy 0

  action car                                 //動作限流

  policy source 192.168.20.0 mask 24           //上傳要指定源地址,目的地址是所有。

  policy car-class upload_class              //引用創建的限流class

#

整體下載限流

traffic-policy enable   //啓用限流功能

#

car-class download_class type shared

car 10000

#

//創建下載的限流策略,上傳的方向是從UntrustTrust

traffic-policy interzone trust untrust inbound shared

  policy 0

  action car                                 //動作限流

  policy destination 192.168.5.0 mask 24      //下載要指定目的地址,地址是所有。

  policy car-class download_class            //引用創建的限流class

#

 

 


 

 

 



 wKioL1kQEXyDd_8UAACSKdcZmvY946.png-wh_50

移動策略的優先級:域或者域內視圖下。


 


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章