需求:INSIDE-10.10.10.0/24需要访问外网(8.8.8.8)
方法一:动态NAT
1.新建network object
2.在object下做NAT(使用外网接口地址做转换)
object network INSIDE-10.10.10.0
subnet 10.10.10.0 255.255.255.0
nat (inside,outside) dynamic interface
exit
access-list OUT-TO-INSIDE extended permit ip any 10.10.10.0 255.255.255.0 //模拟器需要作此策略,真实设备不需要
access-group OUT-TO-INSIDE in interface outside //模拟器需要作此策略,真实设备不需要
测试
INSIDE#ping 8.8.8.8 source vlan 10
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 8.8.8.8, timeout is 2 seconds:
Packet sent with a source address of 10.10.10.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/2 ms
查看ASA防火墙的NAT转换:
ASA(config)# show xlate
1 in use, 3 most used
Flags: D - DNS, e - extended, I - identity, i - dynamic, r - portmap,
s - static, T - twice, N - net-to-net
ICMP PAT from inside:10.10.10.1/22 to outside:200.200.200.1/22 flags ri idle 0:00:01 timeout 0:00:30
方法二:动态NAT
1.新建network object
2.在object下做NAT(使用单独的外网IP做转换)
object network INSIDE-10.10.10.0
subnet 10.10.10.0 255.255.255.0
nat (inside,outside) dynamic 200.200.200.10
exit
access-list OUT-TO-INSIDE extended permit ip any 10.10.10.0 255.255.255.0 //模拟器需要作此策略,真实设备不需要
access-group OUT-TO-INSIDE in interface outside //模拟器需要作此策略,真实设备不需要
测试:
INSIDE#ping 8.8.8.8 source vlan 10
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 8.8.8.8, timeout is 2 seconds:
Packet sent with a source address of 10.10.10.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/4/7 ms
ASA# show xlate
1 in use, 4 most used
Flags: D - DNS, e - extended, I - identity, i - dynamic, r - portmap,
s - static, T - twice, N - net-to-net
ICMP PAT from inside:10.10.10.1/27 to outside:200.200.200.10/27 flags ri idle 0:00:00 timeout 0:00:30
原文地址:http://blog.51cto.com/tommyking/2095372