配置IPSEC-VPN
IKE的存在主要是为了IPSEC协商SA,它为IPSEC进行了铺路.两边对等体要就IKE的安全策略进行协商,我们可以定义多个IKE策略在每一边,最终对等体协商一个双方都相同的策略.IKE第一阶段协商成功IKE SA(主交换模式),然后进行IPSEC SA的协商(快速交换模式),2阶段协商成功后,可以进行正常的IPSEC数据通信了.
IKE的策略配置主要包含:
1.加密算法 encryption 默认:DES
2.散列算法 hash 默认:SHA 如果路由器不够强大,建议使用 MD5
3.密钥交换 group 默认 1
4.验证方法 authentication 默认 rsa-sig 如果使用RSA-SG则要用CA建立KEY,如果使用pre-share则在路由器中配置key
5.IKE SA生命周期 lefttime 默认 86400秒 一天.
dt3-45a(config)#crypto isakmp policy 1
进入IKE 策略编辑模式,后面的数字序号可以区别各个策略,且数字越小被能被优先使用
dt3-45a(config-isakmp)#encryption des
默认的加密方式
dt3-45a(config-isakmp)#group 2
Diffie-Hellman 密钥交换方法,Group 1 is 768 bits long, and group 2 is 1024 bits long.路由器不够强大建议使用group 1,默认也是1
dt3-45a(config-isakmp)#hash md5
散列算法,默认SHA,路由器不够强大就使用MD5
dt3-45a(config-isakmp)#lifetime 500
IKE SA生命周期,默认86400秒,也就是一天,路由器不够强大则不建议太短.
dt3-45a(config-isakmp)#authentication pre-share
验证方法,默认RSA-SG,使用RSA-SG需要配合CA.使用pre-share就需要使用crypto isakmp key **** address peer-address来指定key
dt3-45a(config-isakmp)#exit
dt3-45a(config)#crypto isakmp key Slurpee-Machine address 192.168.10.38
这里的KEY要和对等体的配置一样.
You are now done with IKE configuration. These lines are the IKE configuration of the peer (the complete configurations for both routers are in the Sample Configurations section of this document):
crypto isakmp policy 1
hash md5
group 2
authentication pre-share
crypto isakmp key Slurpee-Machine address 192.168.10.66
Create extended ACL.
dt3-45a(config)#access-list 101 permit ip 192.168.3.0 0.0.0.255 10.3.2.0 0.0.0.255
Create IPSec transform(s).
dt3-45a(config)#crypto ipsec transform-set MamaBear ah-md5-hmac esp-des
Create crypto map.
dt3-45a(config)#crypto map armadillo 10 ipsec-isakmp
dt3-45a(config-crypto-map)#set peer 192.168.10.38
dt3-45a(config-crypto-map)#set session-key lifetime seconds 4000
dt3-45a(config-crypto-map)#set transform-set MamaBear 这里还可以继续写多个转换集名
dt3-45a(config-crypto-map)#match address 101
Apply crypto map tothe interface.
dt3-45a(config)#interface e0
dt3-45a(config-if)#crypto map armadillo