(2)(可选)定义加密算法
(isakmp)encryption {des | 3des}
加密模式可以为56位的DES-CBC(des,默认值)或者168位的3DES(3des)
(3)(可选)定义散列算法 (isamkp)hash {sha | md5} 默认sha
(4)(可选)定义认证方式
(isamkp)authentication {rsa-sig | rsa-encr | pre-share} rsa-sig 要求使用CA并且提供防止抵赖功能;默认值 rsa-encr 不需要CA,提供防止抵赖功能 pre-share 通过手工配置预共享密钥
(5)(可选)定义Diffie-Hellman标识符 (isakmp)group {1 | 2}
注释:除非购买高端路由器,或是VPN通信比较少,否则最好使用group 1长度的密钥,group命令有两个参数值:1和2。参数值1表示密钥使用768位密钥,
参数值2表示密钥使用1024位密钥,显然后一种密钥安全性高,但消耗更多的CPU时间。
(6)(可选)定义安全关联的生命期 (isakmp)lifetime seconds
注释:对生成新SA的周期进行调整。这个值以秒为单位,默认值为86400,也就是一天。值得注意的是两端的路由器都要设置相同的SA周期,否则VPN在正 常初始化之后,将会在较短的一个SA周期到达中断。
3、(rsa-sig)使用证书授权(CA) (1)确保路由器有主机名和域名 (global)hostname hostname (global)ip domain-name domain
(2)产生RSA密钥
(global)crypto key generate rsa
(3)使用向IPSec对等端发布证书的CA --设定CA的主机名
(global)crypto ca identity name --设定联络CA所使用的URL (ca-identity)enrollment url url
URL应该采用http://ca-domain-nameort/cgi-bin-location的形式 --(可选)使用RA模式
(ca-identity)enrollment mode ra (ca-identity)query url url
--(可选)设定注册重试参数
(ca-identity)enrollment retry period minutes (ca-identity)enrollment retry count number
minutes(1到60;默认为1) number(1到100;默认为0,代表无穷次) --(可选)可选的证书作废列表 (ca-identity)crl optional
(4)(可选)使用可信的根CA --确定可信的根CA
(global)crypto ca trusted-root name --(可选)从可信的根请求CRL (ca-root)crl query url --定义注册的方法
(ca-root)root {CEP url | TFTP server file | PROXY url}
(5)认证CA
(global)crypto ca authenticate name
(6)用CA注册路由器
(global)crypto ca enroll name
4、(rsa-encr)手工配置RSA密钥(不使用CA) (1)产生RSA密钥
(global)crypto key generate rsa
(2)指定对等端的ISAKMP标识
(global)crypto isakmp identity {address | hostname}
(3)指定其他所有对等端的RSA密钥 --配置公共密钥链
(global)crypto key pubkey-chain rsa
--用名字或地址确定密钥
(pubkey-chain)named-key key-name [encryption | signature] (pubkey-chain)addressed-key key-name [encryption | signature]
--(可选)手工配置远程对等端的IP地址 (pubkey-key)address ip-addr
--指定远程对等端的公开密钥 (pubkey-key)key-string key-string
5、(preshare)配置预共享密钥
(global)crypto isakmp key key-string {addrss | hostname} {peer-address
|
peer-hostname}
注释:返回到全局设置模式确定要使用的预先共享密钥和指归VPN另一端路由器IP地址,即目的路由器IP地址。相应地在另一端路由器配置也和以上命令类 似
6、(可选)使用IKE模式
(1)定义要分发的“内部”或者受保护IP地址库
(global)ip local pool pool-name start-address end-address
(2)启动IKE模式协商
(global)crypto isakmp client configuration address-pool local pool-name
--------------IPSec配置----------------
IPSec 使用加密、数据完整性、源发鉴别以及拒绝重演分组来保护和认证网络层对等端之间的IP分组
IPSec对于构建内因网、外因网以及远程用户接入VPN来说非常有用处
IPSec支持以下标准
--Internet协议的安全体系结构 --IKE(Internet密钥交换) --DES(数据加密标准) --MD5 --SHA
--AH(Authentication Header,认证首部)数据认证和反重演(anti-reply)服务
--ESP(Encapsulation Security Payload,封装安全净荷)数据隐私、数据验证以及反重演(anti-reply)服务
敏感流量由访问列表所定义,并且通过crypto map(保密图)集被应用到接口上。 配置
1、为密钥管理配置IKE
2、(可选)定义SA的全局生命期
(global)crypto ipsec security-association lifetime seconds seconds (global)crypto ipsec security-association lifetime killobytes kilobytes
3、定义保密访问列表来定义受保护的流量 (global)access-list access-list-number .... 或者
(global)ip access-list extended name
扩展的访问列表必须定义由IPSec保护哪种IP流量。保密图(crypto map)援引这个访问列表
来确定在接口上要保护的流量。
4、定义IPSec交换集 (1)创建变换集
(global)crypto ipsec transform-set name [transform1 | transform2 | transform3] 可以在一个保密图(crypto map)中定义多个变换集。如果没有使用IKE,那么只能定义一种变换集。用户能够选择多达三种变换。 (可选)选择一种AH变换 --ah-md5-hmac --ah-sha-hmac --ah-rfc-1828
(可选)选择一种ESP加密编号 --esp-des --esp-3des --esp-rfc-1829 --esp-null
以及这些验证方法之一 --esp-md5-hmac --esp-sha-hmac (可选)选择IP压缩变换 --comp-lzs
(2)(可选)选择变换集的模式
(crypto-transform)mode {tunnel | transport}
5、使用IPSec策略定义保密映射
保密图(crypto map)连接了保密访问列表,确定了远程对等端、本地地址、变换集和协商方法。
(1)(可选)使用手工的安全关联(没有IKE协商) --创建保密图
(global)crypto map map-name sequence ipsec-manual
--援引保密访问列表来确定受保护的流量 (crypto-map)match address access-list
--确定远程的IPSec对等端
(crypto-map)set peer {hostname | ip_addr}
--指定要使用的变换集
(crypto-map)set transform-set name 变换集必须和远程对等端上使用的相同
--(仅适用于AH验证)手工设定AH密钥
(crypto-map)set session-key inbound ah spi hex-key-data
(crypto-map)set session-key outbound ah spi hex-key-data
--(仅适用于ESP验证)手工设定ESP SPI和密钥
(crypto-map)set session-key inbound ah spi hex-key-data [authenticator hex-key-data]
(crypto-map)set session-key outbound ah spi hex-key-data [authenticator hex-key-data]
(2)(可选)使用IKE建立的安全关联 --创建保密图
(global)crypto map map-name sequence ipsec-isakmp
--援引保密访问列表来确定受保护的流量 (crypto-map)match address access-list
--确定远程的IPSec对等端
(crypto-map)set peer {hostname | ip_addr}
--指定要使用的变换集
(crypto-map)set transform-set name 变换集必须和远程对等端上使用的相同
--(可选)如果SA生命期和全局默认不同,那么定义它:
(crypto-map)set security-association lifetime seconds seconds (crypto-map)set security-association lifetime kilobytes kilobytes
--(可选)为每个源/目的主机对使用一个独立的SA (crypto-map)set security-association level per-host
--(可选)对每个新的SA使用完整转发安全性 (crypto-map)set pfs [group1 | group2]
(3)(可选)使用动态安全关联 --创建动态的保密图
(global)crypto dynamic-map dyn-map-name dyn-seq-num
--(可选)援引保密访问列表确定受保护的流量 (crypto-map)match address access-list
--(可选)确定远程的IPSec对等端
(crypto-map)set peer {hostname | ip_addr}
--(可选)指定要使用的变换集
(crypto-map)set transform-set tranform-set-name