现在的位置: 首页 > 综合 > 正文

IPSEC VPN 配置

2013年12月13日 ⁄ 综合 ⁄ 共 1868字 ⁄ 字号 评论关闭

 

 

 

 

 

环境:接口地址都已经配置完,路由也配置了,双方可以互相通信了

密钥认证的算法2种:md5和sha1

加密算法2种: des和3des

IPsec传输模式3种:

AH验证参数:ah-md5-hmac(md5验证)、ah-sha-hmac(sha1验证)

ESP加密参数:esp-des(des加密)、esp-3des(3des加密)、esp-null(不对数据进行加密)

ESP验证参数:esp-md5-hma(md5验证)、esp-sha-hmac(采用sha1验证)

1 启用IKE协商

routerA(config)#crypto isakmp policy 1 建立IKE协商策略(1是策略编号1-1000,号
越小,优先级越高

 

routerA(config-isakmap)#hash md5 密钥认证的算法

routerA(config-isakmap)#authentication pre-share 告诉路由使用预先共享的密钥

routerA(config)#crypto isakmp key 123456 address 20.20.20.22 (123456是设置的共享密

20.20.20.22是对端的IP地

址)。

routerB(config)#crypto isakmp policy 1

routerB(config-isakmap)#hash md5

routerB(config-isakmap)#authentication pre-share

routerB(config)#crypto isakmp key 123456 address 20.20.20.21 (路由B和A的配置除了这里

的对端IP地址变成了20.20.20.21,其他都要一样的)。

 

2 配置IPSec相关参数

routerA(cnfog)#crypto ipsec transform-set test ah-md5-hamc esp-des (test传输模式的名

称。ah-md5-hamc esp-des表示传输模式中采用的验证和加

密参数 )。

routerA(config)#acess-list 101 permit ip 192.168.1.0 0.0.0.255 192.168.2.0 0.0.0.255

(定义哪些地址的报文加密或是不加密)

routerB(config)#crypto ipsec transform-set test ah-md5-hamc esp-des

routerB(config)#acess-list 101 permit ip 192.168.2.0 0.0.0.255 192.168.1.0 0.0.0.255

(路由器B和A的配置除了这里的源和目的IP地址变了,其他都一样)

3 设置crypto map (目的把IKE的协商信息和IPSec的参数,整合到一起,起一个名字)

routerA(config)#crypto map testmap 1 ipsec-isakmp (testmap:给crypto map起的名字。

1:优先级。ipsec-isakmp:表示此IPSec链接采用IKE自动协商)

routerA(config-crypto-map)#set peer 20.20.20.22 (指定此VPN链路,对端的IP地址)。

routerA(config-crypto-map)#set transform-set test (IPSec传输模式的名字)

routerA(config-crypto-map)#match address 101 (上面定义的ACL列表号)

routerA(config)#crypto map testmap 1 ipsec-isakmp

routerA(config-crypto-map)#set peer 20.20.20.21 (和A路由的配置只有这里的对端IP不一样)

routerA(config-crypto-map)#set transform-set test

routerA(config-crypto-map)#match address 101

4 把crypto map 的名字应用到端口

routerA(config)#inter s0/0 (进入应用VPN的接口)

routerA(config-if)#crypto map testmap (testmap:crypto map的名字)

B路由和A完全一样

 

查看VPN的配置

查看安全联盟(SA)

Router#show crypto ipsec sa

显示crypto map 内的所有配置

router#show crypto map

查看优先级

router#show crypto isakmp policy

抱歉!评论已关闭.