實驗要求
實驗步驟
一
搭建拓撲,合理規劃網段並配置終端以及防火牆接口IP地址。終端IP地址省略。
防火牆各個接口IP地址:
[USG6000V1]int g1/0/0
[USG6000V1-GigabitEthernet1/0/0]ip ad 192.168.1.254 24
[USG6000V1]int g1/0/1
[USG6000V1-GigabitEthernet1/0/1]ip ad 202.196.1.254 24
[USG6000V1-GigabitEthernet1/0/1]int g1/0/2
[USG6000V1-GigabitEthernet1/0/2]ip ad 10.0.0.254 24
二
配置防火牆安全區域以及安全策略。
安全區域和策略具體配置以及解釋請查看文章:防火牆詳解(三)華爲防火牆基礎安全策略配置(命令行配置)
區域配置命令:
[USG6000V1]firewall zone trust
[USG6000V1-zone-trust]add interface g1/0/0
[USG6000V1]firewall zone untrust
[USG6000V1-zone-untrust]add interface g1/0/1
[USG6000V1]firewall zone dmz
[USG6000V1-zone-dmz]a i g1/0/2
可以通過display zone
查看安全區域具體配置情況
安全策略配置:
[USG6000V1]security-policy
[USG6000V1-policy-security]rule name t2u
[USG6000V1-policy-security-rule-t2u]source-zone trust
[USG6000V1-policy-security-rule-t2u]destination-zone untrust
[USG6000V1-policy-security-rule-t2u]destination-zone dmz
[USG6000V1-policy-security-rule-t2u]action permit
[USG6000V1-policy-security-rule-t2u]q
[USG6000V1-policy-security]rule name u2d
[USG6000V1-policy-security-rule-u2d]source-zone untrust
[USG6000V1-policy-security-rule-u2d]destination-zone dmz
[USG6000V1-policy-security-rule-u2d]action permit
可以通過display security-policy all
查看全部的安全策略,也可以通過display security-policy rule [name]
查看具體規則
三
配置源NAT
命令:
[USG6000V1]nat address-group nat1 //創建NAT地址池
[USG6000V1-address-group-nat1]mode ? //源NAT模式選擇
full-cone Indicate the Fullone mode
no-pat Indicate the NOPAT mode //不使用端口號
pat Indicate the Pat mode //使用端口號(NAPT)
pcp Indicate the PCP mode //
[USG6000V1-address-group-nat1]mode pat //選擇Pat模式
[USG6000V1-address-group-nat1]section 202.196.1.2 202.196.1.10 //設置地址池範圍
[USG6000V1-address-group-nat1]q
[USG6000V1]nat-policy //設置NAT策略
[USG6000V1-policy-nat]rule name nat1 //創建名字
[USG6000V1-policy-nat-rule-nat1]source-zone trust //源區域
[USG6000V1-policy-nat-rule-nat1]destination-zone untrust //目的區域
[USG6000V1-policy-nat-rule-nat1]source-address 192.168.1.0 mask 255.255.255.0 //源地址
[USG6000V1-policy-nat-rule-nat1]action nat address-group nat1 //設置規則,當匹配上述條件則在nat1地址池中選擇地址
驗證:
分別在防火牆G1/0/0和G1/0/1抓包,並內網ping外網,查看地址是否變化。
四
配置NAT Server:
[USG6000V1]nat server server1 protocol icmp global 202.196.1.88 inside 10.0.0.1
no-reverse //配置NAT Server 名稱爲Server1 協議爲IMCP,將10.0.0.1 轉換成202.196.1.88
在這裏插入代碼片
驗證:
注意,ping 202.196.1.88