码迷,mamicode.com
首页 > 其他好文 > 详细

基于GNS3的ASA 5520虚拟防火墙功能测试

时间:2018-12-29 00:13:21      阅读:323      评论:0      收藏:0      [点我收藏+]

标签:extend   water   外部   tun   life   ash   通过   ssh   root   

目的:
测试基于GNS3的ASA 8.4(2)的部分功能配置:
1 内网客户端访问外网;
2 外网访问内网服务器;
3 Lan-to-Lan IPSEC ×××;

####################################################################################
实验拓扑:
技术分享图片

####################################################################################
一 内网客户端通过防火墙访问外网
PC:设置IP 192.168.1.2,gateway: 192.168.1.1
R1: F0/0 192.168.1.1/24
F1/0 192.168.2.1/24
Default gateway: ip route 0.0.0.0 0.0.0.0192.168.2.2

ASA-1:
interface GigabitEthernet0
nameif inside
security-level 100
ip address 192.168.2.2 255.255.255.0
!
interface GigabitEthernet1
nameif outside
security-level 0
ip address 172.16.1.1 255.255.255.0
access-list in-2-out extended permit ip any any
access-group in-2-out in interface outside
nat (inside,outside) source dynamic any interface

route outside 0.0.0.0 0.0.0.0 172.16.1.2 1
route inside 192.168.1.0 255.255.255.0 192.168.2.1 1

测试:
PC-1> ping 172.16.1.3
84 bytes from 172.16.1.3 icmp_seq=1 ttl=254 time=269.845 ms
84 bytes from 172.16.1.3 icmp_seq=2 ttl=254 time=101.949 ms
84 bytes from 172.16.1.3 icmp_seq=3 ttl=254 time=159.903 ms
84 bytes from 172.16.1.3 icmp_seq=4 ttl=254 time=181.896 ms
84 bytes from 172.16.1.3 icmp_seq=5 ttl=254 time=208.890 ms

R1#ssh -l root 172.16.1.3
Password:
R3>

#####################################################################################
二 外网访问内网服务器
前面配置不变,添加如下配置:
object network 172.16.1.10
host 172.16.1.10 #公网地址
object network 2.1_telnet
host 192.168.2.1 #内网地址
nat (inside,outside) static 172.16.1.10 service tcp telnet telnet #映射地址
注:外部接口的端口映射始终无法做通,尝试了不同方法,
1 添加policy;
2 添加策略。
始终不行,怀疑是防火墙版本或者虚拟机的问题,其余配置如下:
object network 2.1_ssh
host 192.168.2.1
nat (inside,outside) static interface service tcp ssh ssh

测试结果:
R3#telnet 172.16.1.10
Trying 172.16.1.10 ... Open
User Access Verification
Username: root
Password:
R1>en

##################################################################################
三 L2L IPSEC ×××
前面配置不变,添加如下配置:
object network inside
subnet 192.168.1.0 255.255.255.0 #定义本端网络地址

object network remote-site-address #定义远端网络地址
subnet 192.168.4.0 255.255.255.0

nat (inside,outside) source static inside inside destination static remote-site-address remote-site-address # 设置感兴趣流避免NAT

crypto ipsec ikev1 transform-set test esp-3des esp-md5-hmac
crypto map crymap 10 match address ***
crypto map crymap 10 set peer 172.16.1.2
crypto map crymap 10 set ikev1 transform-set test
crypto map crymap interface outside
crypto ikev1 enable outside #定义 crypto map参数并应用到外网接口,172.16.1.2为对端公网
地址。

crypto ikev1 policy 10
authentication pre-share
encryption 3des
hash md5
group 2
lifetime 86400 #定义 IPSEC第一阶段加密参数

tunnel-group 172.16.1.2 type ipsec-l2l
tunnel-group 172.16.1.2 ipsec-attributes
ikev1 pre-shared-key ***** #定义隧道类型并设置第一阶段共享密码

测试:
PC-1> ping 192.168.4.2
192.168.4.2 icmp_seq=1 timeout
192.168.4.2 icmp_seq=2 timeout
84 bytes from 192.168.4.2 icmp_seq=3 ttl=62 time=229.871 ms
84 bytes from 192.168.4.2 icmp_seq=4 ttl=62 time=400.765 ms
84 bytes from 192.168.4.2 icmp_seq=5 ttl=62 time=91.948 ms
注意:由于刚开始隧道还没有建议,因此会有几个丢包,正常!

对端PING
PC-2> ping 192.168.1.2
84 bytes from 192.168.1.2 icmp_seq=1 ttl=62 time=350.800 ms
84 bytes from 192.168.1.2 icmp_seq=2 ttl=62 time=228.867 ms
84 bytes from 192.168.1.2 icmp_seq=3 ttl=62 time=206.881 ms
84 bytes from 192.168.1.2 icmp_seq=4 ttl=62 time=299.828 ms
84 bytes from 192.168.1.2 icmp_seq=5 ttl=62 time=284.829 ms

################################################################################
ASA部分诊断命令如下:
show run nat
show run object-network
show run object-group
show nat detail
show xlate
show conn
show nat pool
debug nat 255

基于GNS3的ASA 5520虚拟防火墙功能测试

标签:extend   water   外部   tun   life   ash   通过   ssh   root   

原文地址:http://blog.51cto.com/goldream/2336667

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!