您的当前位置:首页正文

CISCO Easy VPN学习笔记

来源:个人技术集锦
Easy VPN学习笔记

【理论部分】

EzVPN(Remote Access VPN) 

主要是在路由器上来配置一个EzVPN的Server和Client。 2大功能:

1、简化Client端的配置

2、集中的Client端的管理和动态地推送一些策略给Client 上面的2大功能如何来实现呢? 1、IKE的1.5阶段Mode config来集中化地推送一些策略给Client,由Server端配置

2、Client端为什么是简化配置呢?她会有一些预配置的IKE的Policy和IPSec transform sets,所以说呢,我们在Client端是不需要配置第一阶段的Policy和第二阶段的转换集的,这就相对要简单一些,当然她会有一些限制,请看下表: Nonsupported IPSec Protocol Options and Attributes Options 

Authentication Types 

Attributes 

Authentication with public key encryption Digital Signature Standard(DSS) 1 IPSEC_AH Transport mode 

Manual keys                        Perfect Forward Secrecy(PFS) 

Diffie‐Hellman(D‐H) groups IPSec Protocol Identifier IPSec Protocol Mode Miscellaneous 

EzVPN的组件

Easy VPN Server:可以在路由器上做,也可以在PIX/ASA做,也可以在防火墙上做,也可以在VPN集中器上做,

Easy VPN Remote:可以在路由器上做,也可以在PIX/ASA做,也可以在防火墙上做,也可以在VPN的硬件Client(VPN3002)或者是软件Client上做 下面是EzVPN的详细介绍

1、The VPN client initiates the IKE Phase 1 process. 2、The VPN client establishes an ISAKMP SA. 3、The Easy VPN Server accepts the SA proposal.

4、The Easy VPN Server initiates a username and password challenge.(XAuth—Extended Authentication)

5、The mode configuration process is initiated. 6、The RRI process is initiated.

7、IPSec quick mode completes the connection.

首先,跟普通的VPN一样,也需要先来协商建立一条EzVPN的通道,始发端肯定是Client初始化IKE Phase process,那么,第一阶段和第二阶段还是有的,目

的也是一样,第一阶段协商Policy,因为Client端是预配置的一些Policy,全部发到Server端,由Server做一个验证,然后交换Key,做一个Peer的认证(2个Peer是EzVPN的Server端和Client端),第一阶段协商就建立一个ISAKMP的SA,Server是要接受所有SA的proposal,Client端预配置的这些proposal这些Policy全部发到Server端,Server端要接受其中的一个,还是从序列号最小的开始匹配,然后呢,EzVPN的Server要要求一个用户名和密码的challenge,这就是1.5阶段的XAuth,叫做Extended Authentication,做一个用户名密码的验证,紧接着就是进入了Mode Configuration,Server端是集中化地配置了这些策略推送给Client,这也是1.5阶段,1.5阶段呢,一个是做XAuth,一个是做mode configuration,当然XAuth你可以禁掉,也就是说我不要求你输入用户名和密码,通常为了安全起见,我们是要做这个XAuth,那mode config是要推送一些策略,什么策略呢?最基本的就是要分给你一个IP地址,然后就是反向路由注入(RRI),这一会我们来看一下她的反向路由注入是如何实现的,又为什么需要反向路由注入,以上就是第一阶段,完成之后第二阶段快速模式跟LAN‐to‐LAN没有任何区别。 那么看一下她协商的一个具体的过程:

Step 1:The VPN Client Initiates the IKE Phase 1 Process *  Using pre‐shared keys? Initiate aggressive mode. *  Using digital certificates? Initiate main mode. 

第一阶段由Client端初始化,你是使用什么Mode,我们在前面介绍的都是Main Mode,对吧!如果EzVPN使用Pre‐shared keys做为验证的话呢,她就使用的是aggressive mode,这个Mode相对简单,只有3个message的交换,在第一个message做Policy的验证的同时呢会把DH产生Key的材料比如说公钥会一同发过去,Server端在接受某一个Policy的同时呢也会把她做DH交换的这些材料比如说公钥发给对端,最后做一个验证。如果使用的是数字证书,她同样也是Main Mode,是一样的。

Step 2:The VPN Client Establishes an ISAKMP SA

*  The VPN client attempts to establish an SA between peer IP addresses by sending multiple ISAKMP proposals to the Easy VPN Server. 

*  To reduce manual configuration on the VPN client, these ISAKMP proposals include several combinations of the following: 

—  Encryption and hash algorithms —  Authentication methods —  Diffie‐Hellman group sizes

Client端把她所有的proposals也就是第一阶段的Policy全部发过去,注意,我们不能够使用group 1,只能使用group 2,因为所有的这些proposals与pre‐shared key相关的只有group 2,所以我们在做Server的时候呢Policy一定要是group 2,这些Policy也跟LAN‐to‐LAN的一样,加密,哈希的算法,认证的方法(per‐shared key还是RSA的签名),DH group(1、2、5),当然啦,现在的所有的proposals全都是2,基于per‐shared key的。

Step 3:The CISCO Easy VPN Server Accepts the SA Proposal *  The Easy VPN Server searches for a match: 

—  The first proposal to match the server list is accepted(highest‐priority match).

—  The most secure proposals are always listed at the top of the Easy VPN Server proposal list(highest priority). *  The ISAKMP SA is successfully established. 

*  Device authentication ends and user authentication begins. 

第三步就是Server端同意使用一个Policy,比如说加密3DES,哈希MD5,包括一些认证的方法,pre‐shared key这些同意其中的一个,建立ISAKMP的SA,也就是第一阶段的协商完成,协商完成之后,她除了Peer的验证还需要一个用户的验证,也就是XAuth。

Step 4:The CISCO Easy VPN Server Initiates a Username and Password Challenge *  If the Easy VPN Server is configured for Xauth, the VPN client waits for a username/password challenge: 

—  The user enters a username/password combination.

—  The username/password information is checked against authentication entities using AAA.

*  All Easy VPN Servers should be configured to enforce user authentication. 第一阶段协商完成之后,她除了Peer的验证还需要一个用户的验证,也就是XAuth,要求你输入一个用户名和密码,这个用户名和密码可以是在Easy VPN Server本地,也可以是AAA服务器上的,当这个用户名和密码的验证通过之后呢,就进入了Mode Configuration,这还是1.5阶段。 Step 5:The Mode Configuration Process Is Initiated

*  If the Easy VPN Server indicates successful authentication, the VPN client requests the remaining configuration parameters from the Easy VPN Server: —  Mode configuration starts.

—  The remaining system parameters(IP address, DNS, split tunneling information, and so on) are downloaded to the VPN client.

*  Remember that the IP address is the only required parameter in a group profile; all other parameters are optional. 这还是1.5阶段,主要就是Server端推送一些参数给Client,Client询问一些参数,那么这里边都有一些什么样的配置呢?最基本的就是IP Address,也只有这个是必须的,其他的参数都是可选(Optional)的,其他参数包括什么呢?DNS服务器的地址,split tunnel,当这个完成之后,就进入第二阶段。 Step 6:The RRI Process Is Initiated

*  RRI should be used when the following conditions occur: —  More than one VPN server is used

—  Per‐client static IP addresses are used with some clients (instead of using per‐VPN‐server IP pools)

*  RRI ensures the creation of static routes. 

*  Redistributing static routes into an IGP allows the servers site routers to find the appropriate Easy VPN Server for return traffic to clients. 

在第二阶段之前呢,还有一个反向路由注入,那么我们来看一下,为什么她需要反向路由注入? 反向路由注入(RRI)

我们Easy VPN的Server,这边是接Internet,Client在这边(Client的PC上装了Remote VPN的软件),拨到ISP有一个公网的IP(有这个公网IP你才能跟Server通信),Client去拨号到Server,那么这个时候Server会给Client分配一个IP地址(192.168.168.100),这就是Mode Config,当然了也只有这个参数是必须的,Client就是通过这个地址(192.168.168.100)来访问Server内部的网络(比如说是10.1.1.0这个网络),那么源地址就是192.168.168.100,目的地址就是10.1.1.1(这里比方说是10.1.1.1这个地址),然后把这个源程序包封装ESP(Remote VPN只支持ESP),前面再有一个新的IP包头,新的IP包头的源地址就是Client端的公网IP,目的地址就是Server端的公网IP,所以说呢从微观上来讲加密点和通信点还不是在一起,虽然说都是在PC上(当你的PC安装完Client端软件的时候呢,你就会发现你PC上会多一块CISCO VPN的网卡,那么现在你的PC上就有2块网卡了,一块是拨号的网卡,一块是CISCO VPN的网卡),所以说呢使用的是Tunnel Mode,好了,这个包发出去到达对端,到达对端的加密点时就要解密,把源把ESP去掉,目的地址是10.1.1.1,那么直接发到10.1.1.1去,那么这个包返回时,目的就是192.168.168.100,源地址是10.1.1.1,再在这基础上封装ESP,封装新的IP包头发回来,但是我们要想一下,目的地址是192.168.168.100在这台VPN的Server上有路由吗?肯定是没有路由的对吧,所以说呢这时候我就得需要有她的路由,你肯定不可能是静态地起,你不知道分配给这个Client会是什么地址,我Client这边的地址是动态变化的,这就需要RRI,注入这么一条肯定是32位的主机路由,下一跳就是Client过来的这个公网IP,这就是反向路由注入。 反向路由注入的好处:通过重分布进IGP,让所有的路由器都知道。 RRI规则:

1、LAN‐to‐LAN RRI规则 以感兴趣流的目的为网络,以Peer地址为下一跳,注入这么一条静态路由(当你把map应用到接口上时路由就出来了,我是需要这么一条路由的,要这条路由去协商IPSec通道的,如果没有,根本没法协商) 2、Soft client / EzVPN client mode Server端的RRI规则

以分配给client的地址为网络(32),以这个client的公网IP为下一跳,注入一条32位主机路由(软件拨过来时才会产生,只有你拨号过来时我才知道你的IP地址,

我才知道以哪一个地址为网络去注入这么一条32位的主机路由,跟lan‐to‐lan注入的时机是不同的)

3、EzVPN network‐extension mode Server端RRI注入规则

以Client端的内部网路为网络,以Client公网IP为下一跳,注入一条静态路由(她就更像一个lan‐to‐lan的网路扩展模式) 4、Remote VPN 的 RRI 跟 lan‐to‐lan 不同 RA是当client拨入VPN时注入的 LAN‐to‐LAN是配置完就马上注入

Step 7:IPSec Quick Mode Completes the Connection

*  After the configuration parameters have been successfully received by the VPN client, IPSec quick mode is initiated to negotiate IPSec SA establishment. *  After IPSec SA establishment, the VPN connection is complete. 

反向路由注入完成之后这个1.5阶段也就完成了,进入第二阶段,第二阶段还是叫Quick Mode,跟LAN‐to‐LAN没有任何区别,主要是用来协商IPSec的一些参数,ESP是DES还是3DES,哈希是MD5还是SHA‐1,协商完这些参数后IPSec的SA就建立起来,整个这个VPN的通道就建立完成,然后就是数据流的传输。 以上就是Easy VPN整个协商的过程,实际上区别就是多了一个1.5阶段,Xauth和mode configuration,第一阶段如果使用PSK的话,模式跟LAN‐to‐LAN的不一样,是主动模式(aggressive mode),她的协商是3个包的交换。 Split Tunnel 

Tunnel everything 

默认不做就是Tunnel everything,这就意味着所有的数据流都要加密,也就是说你所有的数据流都要以源地址为192.168.168.100来访问,前面要封闭ESP,要产生新一IP包头,要到Server去,这样将导致一个什么现像呢?

Tunnel everything except local LAN traffic 

起用Tunnel everything except local LAN traffic,你本地的网络,明文不加密了,其他的数据流只要出去就加密,在12.4以前的路由器上是不支持的,但VPN3000支持。

Split Tunneling 

这个也是Server端Mode Config推送给Client,在Server端来配置Split Tunneling,意思是我配置了,满足这个流量才走加密,其他所有的我都不加密,这样你不但可以访问本地的网络,你还可以在本地去访问Internet。

做Split Tunneling之前和之后的对比(Split Tunneling—Before and After)

做之前:你所有的数据流全部到达VPN的设备(当然啦,不是说你不能上网,你可以通过这个VPN网关设备出去上网,据说CISCO也是这样的,CISCO员工拨上VPN网关后绕到美国那边去上网的)。 做之后:我需要加密的流量,也就是说,我访问公司内部网络10.1.1.0这个网络,我加密封装过去,目的不是这个网络呢我直接走本地,她有点像LAN‐to‐LAN的感兴趣流。

下面就是VPN的一个配置(CISCO Easy VPN Server Configuration Tasks) *  Configuring a user 

*  Enabling AAA using the local database *  Configuring the Easy VPN Server 

■Phase 1 ( ISAKMP policy / Group policy / ISAKMP profile ) ■Phase 2 ( IPSec transform set ) ■dynamic map / crypto map 一共有这么几步:

★配置一个用户,用于做Xauth,扩展认证; ★使用本地数据库启用AAA; ★配置Easy VPN Server。

要把握住两个阶段,第一阶段,ISAKMP的Policy,这个Policy要注意Group要是2,然后就是VPN Group的Policy(也就是mode configuration的一些参数,包括我分配给你的是什么IP,我要用什么样的Split Tunneling,她是通过Group来做的,比如说你拨号也是拨到Group,VPN的哪一个组,你可以在设备上设置多个组,比如说我们这个公司有多个部门,有财务部,市场部,技术部等等,你就希望这几个部门的人拨上来后有不同的策略,比如说我分配不同网段的地址,分配不同的Split Tunneling,你财务部的能访问哪些服务器,你市场部的能访问哪些服务器不能访问哪些服务器,你技术部的分配给你一个不同网段的IP,通过这些做一些限制,这就是Mode Configuration的一些参数在哪设置,就是在Group里设置),这个Group是组,可以是本地,也可以是AAA,用AAA服务器时这个Group的Policy必须是RADIUS服务器,还有一个ISAKMP profile我们是用新的命令来做,那第二阶段很简单,跟LAN‐to‐LAN也是一样的,就是一个转换集(transform set),那么我们最后要做一个动态的Map,因为对端的地址是变化的,所以我们需要动态的Map,最终应用到接口上的肯定是静态的Map,所以说最终还是得做一个Crypto Map,把这个Map调到接口下。 Easy VPN实验拓扑图

VPN Server上的配置命令 没有启用Split Tunneling

VPN_Server(config)#username cisco password cisco VPN_Server(config)#aaa new model 

VPN_Server(config)#aaa authentication login NOAU none VPN_Server(config)#line console 0 

VPN_Server(config‐line)#login authentication NOAU VPN_Server(config‐line)#line vty 0 4 

VPN_Server(config‐line)#login authentication NOAU VPN_Server(config‐line)#exit 

VPN_Server(config)#aaa authentication login xauth local 

VPN_Server(config)#aaa authorization network modeconf local VPN_Server(config)#crypto isakmp policy 10 

VPN_Server(config‐isakmp)#authentication pre‐share VPN_Server(config‐isakmp)#group 2 VPN_Server(config‐isakmp)#hash md5 VPN_Server(config‐isakmp)#exit 

VPN_Server(config‐isakmp‐group)#key cisco123 VPN_Server(config‐isakmp‐group)#pool ezvpnpool VPN_Server(config‐isakmp‐group)#dns 192.168.4.254 VPN_Server(config‐isakmp‐group)#domain cisco.com VPN_Server(config‐isakmp‐group)#wins 192.168.4.254 VPN_Server(config‐isakmp‐group)#exit 

VPN_Server(config)#ip local pool ezvpnpool 192.168.168.100 192.168.168.200 VPN_Server(config)#interface loopback 0 

VPN_Server(config‐if)#ip address 192.168.4.1 255.255.255.0 VPN_Server(config)#crypto isakmp profile ISA 

VPN_Server(conf‐isa‐prof)#match identity group EZVPN VPN_Server(conf‐isa‐prof)#client authentication list xauth VPN_Server(conf‐isa‐prof)#isakmp authorization list modeconf VPN_Server(conf‐isa‐prof)#client configuration address respond VPN_Server(conf‐isa‐prof)#exit 

VPN_Server(config)#crypto ipsec transform‐set MYSET esp‐des esp‐md5‐hmac VPN_Server(cfg‐crypto‐trans)#exit 

VPN_Server(config)#crypto dynamic‐map DMAP 10 

VPN_Server(config‐crypto‐map)#set transform‐set MYSET VPN_Server(config‐crypto‐map)#set isakmp‐profile ISA VPN_Server(config‐crypto‐map)#reverse‐route VPN_Server(config‐crypto‐map)#exit 

VPN_Server(config)#crypto map SMAP 10 ipsec‐isakmp dynamic DMAP VPN_Server(config)#interface e0/0 

VPN_Server(config‐if)#crypto map SMAP VPN_Server(config‐if)#exit VPN_Server(config)# 

Remote设置(CISCO VPN Client)

启用Split Tunneling

VPN_Server(config)#crypto isakmp client configuration group EZVPN VPN_Server(config‐isakmp‐group)#acl 101 VPN_Server(config‐isakmp‐group)#exit 

VPN_Server(config)#access‐list 101 permit ip 192.168.4.0 0.0.0.255 any  

VPN_Server#show ip route 

以上是通过软件Client,下面我们来看一下通过硬件Client client模式

EzVPN_Client_R2(config)#crypto ipsec client ezvpn cisco EzVPN_Client_R2(config‐crypto‐ezvpn)#peer 218.18.100.4 

EzVPN_Client_R2(config‐crypto‐ezvpn)#group EZVPN key cisco123 

EzVPN_Client_R2(config‐crypto‐ezvpn)#mode client (共有2种模式:client和network‐extension)

EzVPN_Client_R2(config‐crypto‐ezvpn)#connect manual (auto和manual) EzVPN_Client_R2(config‐crypto‐ezvpn)#exit EzVPN_Client_R2(config)#interface e0/0 

EzVPN_Client_R2(config‐if)#crypto ipsec client ezvpn cisco outside EzVPN_Client_R2(config‐if)#interface loopback 0 

EzVPN_Client_R2(config‐if)#crypto ipsec client ezvpn cisco inside EzVPN_Client_R2(config‐if)#end 

EzVPN_Client_R2#crypto ipsec client ezvpn connect  EzVPN_Client_R2#crypto ipsec client ezvpn xauth Username: cisco Password: cisco 

EzVPN_Client_R2# 

EzVPN_Client_R2#show crypto ipsec client ezvpn 

在Server端查看

VPN_Server(config)#show ip route 

测试(注意:是以内部网络为源去测试,你不要直接去测)

清掉VPN 方法一:

EzVPN_Client_R2#clear crypto ipsec client ezvpn 方法二:

EzVPN_Client_R2#clear crypto sa 

EzVPN_Client_R2#clear crypto isakmp network‐extension模式

EzVPN_Client_R2(config)#crypto ipsec client ezvpn cisco EzVPN_Client_R2(config‐crypto‐ezvpn)#peer 218.18.100.4 

EzVPN_Client_R2(config‐crypto‐ezvpn)#group EZVPN key cisco123 EzVPN_Client_R2(config‐crypto‐ezvpn)#mode network‐extension 

EzVPN_Client_R2(config‐crypto‐ezvpn)#connect manual (auto和manual) EzVPN_Client_R2(config‐crypto‐ezvpn)#exit EzVPN_Client_R2(config)#interface e0/0 

EzVPN_Client_R2(config‐if)#crypto ipsec client ezvpn cisco outside EzVPN_Client_R2(config‐if)#interface loopback 0 

EzVPN_Client_R2(config‐if)#crypto ipsec client ezvpn cisco inside EzVPN_Client_R2(config‐if)#end 

EzVPN_Client_R2#crypto ipsec client ezvpn connect  EzVPN_Client_R2#crypto ipsec client ezvpn xauth Username: cisco Password: cisco EzVPN_Client_R2# 

版权所有:Jackyluo 2010-4-19于深圳

因篇幅问题不能全部显示,请点此查看更多更全内容