##########################################################
% f& C* O4 R0 ?1 Q7 i##########################################################7 A7 a8 a; l8 ~; C8 V( j: U
ronghuifire# conf t---------------第一定义本地地址池
# R! j) r' N5 g( Z) Y) h ~ronghuifire(config)# ip local pool vpn-pool 192.168.1.150-192.168.1.160 mask 255.255.255.0---定义本地地址池
2 X) o. j! v7 E! ]# c1 O g+ {" c) l+ ~
ronghuifire# conf t---------------第二定义internet密钥交换协议(IKE)# a3 r' z; e' J6 L# X$ z& a' x& Q
ronghuifire(config)# crypto isakmp enable outside-----------outside接口启用isakmp7 O0 l$ z2 X5 `: F6 q
ronghuifire(config)# crypto isakmp policy 10------进入isakmp的策略定义模式
8 f4 y) |5 a0 K) Q2 Mronghuifire(config-isakmp-policy)# authentication pre-share-----使用pre-shared key进行认证
; G( [# U, s! |+ w- Q* Kronghuifire(config-isakmp-policy)# encryption des5 _" t* D' H+ K+ \) M. L
ronghuifire(config-isakmp-policy)# hash md5---定义协商用md5加密算法(和前面一样,网上使用的是sha,我这里为了配合前面的esp-md5-hmac,而使用md5)
4 [: `0 l6 G4 P7 J. h6 ~. wronghuifire(config-isakmp-policy)# group 2----定义协商组为2,标准有1、2、3、5等多组,主要用于块的大小和生命时间等
$ N, S1 ]. C$ t2 }. Qronghuifire(config-isakmp-policy)# lifetime 86400------定义生命时间! C& V5 O! }6 B8 g7 U5 s
ronghuifire(config-isakmp-policy)# exit8 I/ p! |$ O' G+ v
ronghuifire# conf t-------第三定义转换集
9 `6 x/ e4 ~( r; mronghuifire(config)# crypto ipsec transform-set transvpnset esp-des esp-md5-hmac---定义变换集transvpnset,用esp-md5加密
3 S! b0 E/ z g4 U" x$ o0 A0 ]" f1 jronghuifire# conf t-------第四动态加密映射6 W2 Q6 K$ c# f
ronghuifire(config)# crypto dynamic-map dymap 10 set transform-set transvpnset----把transvpnset添加到动态加密策略dynmap 10
2 K1 x O+ L( B, E* x! F/ Fronghuifire(config)# crypto dynamic-map dymap 10 set reverse-route----开起反向路由注入连接基于这个动态加密策略dymap 10; }9 I& x& y' q# u: o6 T
ronghuifire(config)# crypto dynamic-map dymap 10 set security-association lifetime seconds 288000- Q6 n+ i0 A) O) h* o3 x
ronghuifire# conf t-------第五在静态加密映射中调用动态加密映射并应用在接口上面
/ O% R: x# e& G& N' e8 e8 M8 Lronghuifire(config)# crypto map vpnmap 10 ipsec-isakmp dynamic dymap ----把动态加密策略绑定到dymap动态加密图上
- q9 q0 p* m' [5 T v+ J7 yronghuifire(config)# crypto map vpnmap interface outside----把动态加密图vpnmap绑定到outside口) \! E1 @# M2 G
ronghuifire# conf t-------第六配置nat穿越(它的主要作用是将三层IPSEC的ESP流量转发为四层的UDP流量。ESP是一个三层的包,只有协议号,没有端口号,当它想穿越一个PAT设备时,由于PAT设备是基于端口的转换,所以ESP包过不了,这时就要将它封装进UDP包才能正常传输源目端口都是UDP4500,,,未加此命令会出现可以ping能内网地址,但不能访问内网服务,比如23、80等端口。)
+ y; v5 b- e3 vronghuifire(config)# crypto isakmp nat-traversal //缺省keepalives时间20秒
8 k# h! p8 @! l7 F5 xronghuifire# conf t-------第七配置访问列表旁路,通过使用sysopt connect命令,我们告诉ASA准许SSL/IPsec客户端绕过接口的访问列表:
/ v& D; v& E* cronghuifire(config)# sysopt connection permit-ipsec
2 M Z% Z7 N1 E- k6 o3 zronghuifire# conf t-------第八定义组策略,组策略用于指定应用于所连接客户端的参数+ L) K, t0 s, G5 M2 P) h
ronghuifire(config)# group-policy ronghui internal-----定义策略组(用于想进入的)想要运用策略组就必须用默认的策略组名,否则无法激活该组。
6 E# F6 ]# V7 R" ]ronghuifire(config)# group-policy ronghui attributes-----定义策略组属性- j8 T; D2 T0 P( z
ronghuifire(config-group-policy)# vpn-idle-timeout 60 设置VPN超时时间为30分钟(可选) Y# z4 e9 S7 P: U
ronghuifire(config-group-policy)# vpn-tunnel-protocol ipsec& M! V# ^8 ~7 U$ @
ronghuifire# conf t-------第九定义隧道
0 e# i- ~) |2 `9 G: q- }4 P* }& ironghuifire(config)# tunnel-group ronghui type ipsec-ra -----建立VPN 远程登入(即使用隧道分离)组3 q5 J9 H* w1 E0 ~
ronghuifire(config)# tunnel-group ronghui general-attributes----定义隧道组"ronghui"属性: J- O) `, T% x) x! f; Z$ O; M$ k
ronghuifire(config-tunnel-general)# address-pool vpn-pool ----将前面建立vpnippool地址池绑定到"ronghui"隧道组2 B$ u. P0 Y. i& ?
ronghuifire(config-tunnel-general)# authentication-server-group (outside) LOCAL----本地认证服务组) f9 p( L! K2 f! j) I
ronghuifire(config-tunnel-general)# default-group-policy ronghui-----默认策略组为ronghui9 V# [) s6 ^" a0 a& ^
ronghuifire(config-tunnel-general)# exit
: B) j. L. u# b, ?' d4 X& Q; E) M/ B4 U5 B
ronghuifire(config)# tunnel-group ronghui ipsec-attributes---定义ronghui组IPSec的属性8 F- [5 V. u- C3 K
ronghuifire(config-tunnel-ipsec)# pre-shared-key 123456-----定义共享密钥; k/ N0 }% J0 Y/ E0 ~& C% ?! Z
ronghuifire(config-tunnel-ipsec)# isakmp nat-traversal 20-----每20秒向VPN对端发送一个包来防止中间PAT设备的PAT超时
) M4 s$ Z" H) r4 n, eronghuifire# conf t-------第十定义用户( ]# P1 w; D3 z. o) `
ronghuifire(config)# username xqliu password 123456-----设置用户名密码6 Q( X" j& b4 a s
ronghuifire(config)# username xqliu attributes0 y8 Y* u' Y3 F2 G, ]5 u
ronghuifire(config-username)# vpn-group-policy ronghui
3 y8 I8 h# l9 T6 d a3 |" |% y& A1 C
, z7 y, [6 m2 Yronghuifire# conf t-------第十一定义nat免除,我们需要告诉ASA不要对远程访问客户端和要访问的内部网络之间的通信做nat' F0 w# @5 o7 |% ]8 E6 }* n. x
ronghuifire(config)#access-list vpn-no-nat permit ip 192.168.1.0 255.255.255.0 192.168.2.200 255.255.255.255
+ h9 P* l ?8 b* C! Q, Wronghuifire(config)# nat (inside) 0 access-list vpn-no-nat ------设置IPSEC VPN数据不作nat翻译) U. H8 y6 y5 g) I* \
ronghuifire# conf t-------第十二定义隧道分离
+ \0 R4 i( F2 i3 Y: C4 h8 Wronghuifire(config)# access-list vpnsplit standard permit 192.168.1.0 255.255.255.0-----注意源地址为ASA的inside网络地址 f6 G& h5 S6 s: g; w7 h8 X
ronghuifire(config)# group-policy ronghui attributes
4 u( g; m( F, |& e }: qronghuifire(config-group-policy)# split-tunnel-policy tunnelspecified
% m* o& g! t: V$ F, F+ y/ wronghuifire(config-group-policy)# split-tunnel-network-list value vpnsplit
% d! d3 e( B2 Z% U. X########################################################## |