NAT类型 | 描述 | 是否配置黑洞路由 |
NAT no-PAT | 当公网用户访问转换后地址时产生环路或者产生ARP报文 | 是 |
NAT PAT | 当公网用户访问转换后地址时产生环路或者产生ARP报文 | 是 |
Easy-ip(出口地址) | 转换后的地址就是外网接口的地址,公网用户访问该地址被防火墙接收(策略允许)或丢弃(策略不允许),不产生环路 | 否 |
NAT Server (粗泛) | 当公网用户访问映射地址时直接转发给内部服务器 | 否
|
NAT Server (精细) | 当公网用户访问映射地址时产生环路或者产生ARP报文 | 是 |
sys
[USG6000V1]in g1/0/0
[USG6000V1-GigabitEthernet1/0/0]ip add 100.1.1.2 30
[USG6000V1-GigabitEthernet1/0/0]in g1/0/4
[USG6000V1-GigabitEthernet1/0/4]ip add 192.168.3.1 24
[USG6000V1-GigabitEthernet1/0/4]in g1/0/3
[USG6000V1-GigabitEthernet1/0/3]ip add 192.168.2.1 24
[USG6000V1-GigabitEthernet1/0/3]in g1/0/2
[USG6000V1-GigabitEthernet1/0/2]ip add 192.168.1.1 24
[USG6000V1-GigabitEthernet0/0/0]in g1/0/1
[USG6000V1-GigabitEthernet1/0/1]ip add 192.168.0.1 24
[USG6000V1-GigabitEthernet1/0/1]quit
[USG6000V1]firewall zone trust
[USG6000V1-zone-trust]add in g1/0/4
[USG6000V1-zone-trust]add in g1/0/3
[USG6000V1-zone-trust]add in g1/0/2
[USG6000V1-zone-trust]quit
[USG6000V1]firewall zone dmz
[USG6000V1-zone-dmz]add in g1/0/1
[USG6000V1-zone-dmz]quit
[USG6000V1]firewall zone untrust
[USG6000V1-zone-untrust]add in g1/0/0
[USG6000V1]ip route-static 0.0.0.0 0.0.0.0 100.1.1.1
##配置安全策略:
[USG6000V1]security-policy
[USG6000V1-policy-security]rule name easy ####定义安全策略名字
[USG6000V1-policy-security-rule-easy]source-zone trust ####源区域为trust
[USG6000V1-policy-security-rule-easy]destination-zone untrust ####目标区域为untrust
[USG6000V1-policy-security-rule-easy]action permit ####动作为允许
[USG6000V1-policy-security-rule-easy]quit
[USG6000V1-policy-security]quit
##配置NAT策略:
[USG6000V1]nat-policy
[USG6000V1-policy-nat]rule name easypolicy ####定义NAT策略名字
[USG6000V1-policy-nat-rule-easypolicy]source-address 192.168.3.0 24 ####定义源地址
[USG6000V1-policy-nat-rule-easypolicy]source-zone trust ####定义源区域
[USG6000V1-policy-nat-rule-easypolicy]destination-zone untrust ####定义目标区域
[USG6000V1-policy-nat-rule-easypolicy]action source-nat easy-ip ####配置出接口方式
[USG6000V1-policy-nat-rule-easypolicy]quit
[USG6000V1-policy-nat]quit
###配置NAT地址组,地址组中的地址对应的是公网地址100.2.2.12/29。
[USG6000V1]nat address-group napt ####定义nat地址组名
[USG6000V1-address-group-napt]section 0 100.2.2.12 ####定义组中的地址
[USG6000V1-address-group-napt]mode pat ####配置为NAPT方式
[USG6000V1-address-group-napt]quit
###配置NAT策略
[USG6000V1]nat-policy
[USG6000V1-policy-nat]rule name napt ####自定义nat策略的组名
[USG6000V1-policy-nat-rule-napt]source-address 192.168.2.0 24 ####定义需要转换的源地址
[USG6000V1-policy-nat-rule-napt]source-zone trust ####定义源区域
[USG6000V1-policy-nat-rule-napt]destination-zone untrust ####定义目标区域
[USG6000V1-policy-nat-rule-napt]action source-nat address-group napt ####关联地址组
###NAPT的NAT类型要配置黑洞路由,所以要针对转换后的全局地址100.2.2.12/32配置黑洞路由。
[USG6000V1] ip route-static 100.2.2.12 32 NULL 0
###配置NAT地址组,地址组中的地址对应的是公网地址100.2.2.10--100.2.2.11:
[USG6000V1]nat address-group natnopat ####定义nat地址组名
[USG6000V1-address-group-natnopat]section 0 100.2.2.10 100.2.2.11 ####定义组中的地址
[USG6000V1-address-group-natnopat]mode no-pat local ####配置为NAT No-PAT方式
[USG6000V1-address-group-natnopat]quit
###配置NAT策略:
[USG6000V1]nat-policy
[USG6000V1-policy-nat]rule name nopat ####自定义nat策略的组名
[USG6000V1-policy-nat-rule-nopat]source-address 192.168.1.0 24 ####定义需要转换的源地址
[USG6000V1-policy-nat-rule-nopat]source-zone trust ####定义源区域
[USG6000V1-policy-nat-rule-nopat]destination-zone untrust ####定义目标区域
[USG6000V1-policy-nat-rule-nopat]action source-nat address-group natnopat ####关联地址组
[USG6000V1-policy-nat-rule-nopat]quit
[USG6000V1-policy-nat]quit
###针对转换后的全局地址(NAT地址组中的地址)配置黑洞路由:
[USG6000V1]ip route-static 100.2.2.10 32 NULL 0
[USG6000V1]ip route-static 100.2.2.11 32 NULL 0
###配置安全策略:
[USG6000V1]security-policy
[USG6000V1-policy-security]rule name todmz
[USG6000V1-policy-security-rule-todmz]source-zone untrust
[USG6000V1-policy-security-rule-todmz]destination-zone dmz
[USG6000V1-policy-security-rule-todmz]destination-address 192.168.0.0 24
[USG6000V1-policy-security-rule-todmz]service ftp
[USG6000V1-policy-security-rule-todmz]service http
[USG6000V1-policy-security-rule-todmz]action permit
###配置NAT server:
[USG6000V1]nat server ftp protocol tcp global 100.2.2.9 21 inside 192.168.0.2 21
[USG6000V1]nat server http protocol tcp global 100.2.2.9 80 inside 192.168.0.3 80
[USG6000V1]dis firewall server-map
2020-02-12 09:31:47.960
Current Total Server-map : 4
Type: Nat Server, ANY -> 100.2.2.9:80[192.168.0.3:80], Zone:---, protocol:tc
p
Vpn: public -> public
Type: Nat Server, ANY -> 100.2.2.9:21[192.168.0.2:21], Zone:---, protocol:tc
p
Vpn: public -> public
Type: Nat Server Reverse, 192.168.0.2[100.2.2.9] -> ANY, Zone:---, protocol:
tcp
Vpn: public -> public, counter: 1
Type: Nat Server Reverse, 192.168.0.3[100.2.2.9] -> ANY, Zone:---, protocol:
tcp
Vpn: public -> public, counter: 1
[USG6000V1]dis firewall se tab
2020-02-12 09:49:58.400
Current Total Sessions : 3
ftp VPN: public --> public 200.1.1.2:2054 +-> 100.2.2.9:21[192.168.0.2:21]
ftp VPN: public --> public 200.1.1.2:2056 +-> 100.2.2.9:21[192.168.0.2:21]
ftp VPN: public --> public 200.1.1.2:2052 +-> 100.2.2.9:21[192.168.0.2:21]
[FW1]
注:由于老化时间,会导致会话表消失