强叔侃墙_NAT_smart NAT示例

来源:互联网 发布:php命名空间的作用 编辑:程序博客网 时间:2024/05/20 06:08
Smart NAT方式也叫作“聪明的NAT”,这是因为它融合了NAT No-PAT方式和NAPT方式的特点。
Smart NAT原理如下。
含N个IP,其中一个IP被指定为预留地址,另外N-1个地址构成地址段1(section1),进行NAT地址转换时,
SmartNAT会优先使用section1进行NATNo-PAT方式的转换,即一对一的地址转换。当section1中的IP都被
占用后,Smart NAT 才使用预留地址进行NAPT方式转换,即多对一的地址转换。
使用ensp usg 6000v进行模拟

强叔侃墙_NAT_smart <wbr>NAT示例
FW1配置

interface GigabitEthernet1/0/0
 undo shutdown
 ip address 202.1.1.1 255.255.255.0
 service-manage ping permit
#
interface GigabitEthernet1/0/1
 undo shutdown
 ip address 192.168.1.1 255.255.255.0
 service-manage ping permit
#
firewall zone trust
 set priority 85
 add interface GigabitEthernet0/0/0
 add interface GigabitEthernet1/0/1
#
firewall zone untrust
 set priority 5
 add interface GigabitEthernet1/0/0
ip route-static 0.0.0.0 0.0.0.0 202.1.1.4

//黑洞路由
ip route-static 202.1.1.2 255.255.255.255 NULL0
ip route-static 202.1.1.3 255.255.255.255 NULL0

nat address-group wan 0
 mode no-pat local
 smart-nopat 202.1.1.3 //预留地址
 section 1 202.1.1.2 202.1.1.2//section不能包含预留地址

security-policy
 rule name policy1
  source-zone trust
  destination-zone untrust
  source-address 192.168.1.0 24
  action permit

nat-policy
 rule name Policy_nat1
  source-zone trust
  destination-zone untrust
  source-address 192.168.1.0 24
  action nat address-group wan //引用nat地址池

验证
[

display firewall session table 
 Current Total Sessions : 1
 http  VPN: public -->public  192.168.1.2:2058[202.1.1.2:2058] -->210.1.1.2:80

从会话表中可以看到,该私网用户的IP地址已经转换为section1中的公网IP地址,端口没有转换。

此时内部网络中的其他私网用户也能够访问web 服务器。
USG6000V1]display firewall sessiontable 
 Current Total Sessions : 3
 http  VPN: public -->public  192.168.1.4:2049[202.1.1.3:2052] -->210.1.1.2:80
 http  VPN: public -->public  192.168.1.3:2052[202.1.1.3:2051] -->210.1.1.2:80
 http  VPN: public -->public  192.168.1.2:2057[202.1.1.2:2057] -->210.1.1.2:80

从会话表中可以看到,两个私网用户的IP地址已经转换为预留的公网IP地址,同时端口
也转换为新的端口,说明防火墙对这两个私网用户进行了NAPT方式的地址转换。


生成server-map表
display firewall server-map 
 Current Total Server-map : 2
 Type: No-Pat Reverse, ANY ->202.1.1.2[192.168.1.2],  Zone:untrust 
 Protocol: ANY, TTL:---, Left-Time:---, Pool: 0, Section: 1
 Vpn: public

 Type: No-Pat, 192.168.1.2[202.1.1.2] -> ANY, Zone: untrust 
 Protocol: ANY, TTL:360, Left-Time:79, Pool: 0, Section: 1
 Vpn: public

原创粉丝点击