ASA实验一:策略 NAT
实验拓朴图
ISP分配给我们的是24位的地址哦。有255-3个IP地址供我们使用,惊喜吧。。
一、实验目的:
1 Outside 电信端可以访问外网口1.1.1.10 www 与FTP服务
2 Inside 区与DMZ区可以互相访问
3 Inside区可以上互联网,配置NAT,在outside口将私有地址转换为公网地址1.1.1.100
----------------------------------实验目的1-------------------------------------------------
1、 配置接口的IP、区域、安全级别
interface Ethernet0/0
nameif inside
security-level 100
ip address 10.10.10.254 255.255.255.0
!
interface Ethernet0/1
nameif dmz
security-level 50
ip address 10.10.20.254 255.255.255.0
!
interface Ethernet0/2
nameif outside
security-level 0
ip address 1.1.1.2 255.255.255.0
route outside 0.0.0.0 0.0.0.0 1.1.1.1 //配置默认路由
2、配置访问策略,
access-list outside extended permit icmp any any echo-reply
//允许从外网返回来的echo-reply包通过。(内网可ping外网,外网不可ping内网)
access-list outside extended permit tcp any host 1.1.1.10 eq ftp
//允许任意网络访问1.1.1.10的21端口
access-list outside extended permit tcp any host 1.1.1.10 eq www
//允许任意网络访问1.1.1.10的80端口
并且应用访问策略
access-group outside in interface outside //应用到外网口
3、配置PAT
static (dmz,outside) tcp 1.1.1.10 www 10.10.20.1 www netmask 255.255.255.255
static (inside,outside) tcp 1.1.1.10 ftp 10.10.10.1 ftp netmask 255.255.255.255
//映射端口,实现PAT转换。
到现在为止,已经可以从外网访问给你的IP 1.1.1.10上的www与ftp服务
现在发现inside区ping dmz区不通,而我们要实现这个功能。
分析,通过抓包,inside的包已经到达了dmz区域,dmz区域也已经回包了,因为DMZ的安全级别为50,而inside为100,低安全级别不能访问高安全级别,这是我们需要加上一条策略。就可以解决这个问题。
这条策略应用到DMZ接口上
access-list dmz extended permit ip 10.10.20.0 255.255.255.0 10.10.10.0 255.255.255.0
access-group dmz in interface dmz //应用策略
现在inside区与DMZ区就可以互相访问了。。
接下来inside区要上网哦,需要两个命令, nat和global ,命令如下:
global (outside) 1 1.1.1.100 netmask 255.255.255.255
nat (inside) 1 0.0.0.0 0.0.0.0
nat (dmz) 1 0.0.0.0 0.0.0.0 //dmz区也上网试试吧
试一下,inside区ping isp,在ISP上面抓包,哈哈。源IP地址已经转换为了1.1.1.100
DMZ区 ping isp 啊。。不通,,为什么呢?
呵呵,刚才不是做了一条ACL吗,只允许DMZ访问inside,就是这个原因。如果需要DMZ区要上网的话,就加上下面这条
access-list dmz permit ip any any
实验结束
二、实验总结:
要将ASA上线,其实很简单。
1、首选配置好IP,配置好区域与安全级别。
2、保证路由要通(这个实验很简单,IP配好了就有路由了,因为是直连嘛,如果inside区还有三层交换机的话,还需要添加防火墙到内部网络的路由)
如 Route inside 192.168.1.0 255.255.255.0 10.10.10.1 //例子而已
查看路由的命令: show route
3、配置策略(ACL)并应用,我习惯在低安全级别的接口的in方向上进行配置。
4、配置nat pat
其它
一对一的nat映射命令,本次实验没有使用。
Static (inside,outside) 1.1.1.100 10.10.10.1 netmask 255.255.255.255
//访问公网1.1.1.100,防火墙会把地址转换为私网10.10.10.1
三、配置文件
ASA(config)# sh run
: Saved
:
ASA Version 8.0(2)
!
hostname netlt
enable password 8Ry2YjIyt7RRXU24 encrypted
names
!
interface Ethernet0/0
nameif inside
security-level 100
ip address 10.10.10.254 255.255.255.0
!
interface Ethernet0/1
nameif dmz
security-level 50
ip address 10.10.20.254 255.255.255.0
!
interface Ethernet0/2
nameif outside
security-level 0
ip address 1.1.1.2 255.255.255.0
!
interface Ethernet0/3
shutdown
no nameif
no security-level
no ip address
!
interface Ethernet0/4
shutdown
no nameif
no security-level
no ip address
!
interface Ethernet0/5
shutdown
no nameif
no security-level
no ip address
!
passwd 2KFQnbNIdI.2KYOU encrypted
ftp mode passive
access-list dmz extended permit ip 10.10.20.0 255.255.255.0 10.10.10.0 255.255.255.0
access-list dmz extended permit ip any any
access-list outside extended permit icmp any any echo-reply
access-list outside extended permit tcp any host 1.1.1.10 eq ftp
access-list outside extended permit tcp any host 1.1.1.10 eq www
pager lines 24
mtu inside 1500
mtu dmz 1500
mtu outside 1500
no failover
icmp unreachable rate-limit 1 burst-size 1
no asdm history enable
arp timeout 14400
global (outside) 1 1.1.1.100 netmask 255.255.255.255
nat (inside) 1 0.0.0.0 0.0.0.0
nat (dmz) 1 0.0.0.0 0.0.0.0
static (dmz,outside) tcp 1.1.1.10 www 10.10.20.1 www netmask 255.255.255.255
static (inside,outside) tcp 1.1.1.10 ftp 10.10.10.1 ftp netmask 255.255.255.255
access-group dmz in interface dmz
access-group outside in interface outside
route outside 0.0.0.0 0.0.0.0 1.1.1.1 1
timeout xlate 3:00:00
timeout conn 1:00:00 half-closed 0:10:00 udp 0:02:00 icmp 0:00:02
timeout sunrpc 0:10:00 h323 0:05:00 h225 1:00:00 mgcp 0:05:00 mgcp-pat 0:05:00
timeout sip 0:30:00 sip_media 0:02:00 sip-invite 0:03:00 sip-disconnect 0:02:00
timeout uauth 0:05:00 absolute
dynamic-access-policy-record DfltAccessPolicy
no snmp-server location
no snmp-server contact
snmp-server enable traps snmp authentication linkup linkdown coldstart
no crypto isakmp nat-traversal
telnet timeout 5
ssh timeout 5
console timeout 0
threat-detection basic-threat
threat-detection statistics access-list
!
!
prompt hostname context
Cryptochecksum:742bc373b4c5dfa7a4e6878119827ee9
: end
呵呵,这是第一个实验,接下来是IPSEC ×××与SSL ×××了。。。
----------------------------------实验目的3-------------------------------------------------
----------------------------------实验目的2-------------------------------------------------