网络拓扑
192.168 1.0
20.20^0 21 so/o
W2JS6 2.0
soioa
20 20 20 22
-g
环境:接口地址都已经配置完,路由也配置了,双方可以互相通信了 密钥认证的算法 2种:md5和shal 加密算法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-hmac(md5 验证)、esp-sha-hmac(采用 sha1 验证)
1启用IKE协商
routerA
routerA(config ) #crypto isakmp policy 1 00,号越小,优先级越高
routerA(c on fig-isakmap)#hash md5
密钥认证的算法
告诉路由使用预先共享的密钥
建立 IKE 协商策略(1 是策略编号 1-10
routerA(co nfig-isakmap)# authe ntication pre-share
routerA(config)# crypto isakmp key 123456 address 20.20.20.22
的共享密 20.20.20.22 是对端的IP地址)。
(123456 是设置
routerB
routerB(c on fig)# crypto isakmp policy 1 routerB(c on fig-isakmap)#hash md5
routerB(c on fig-isakmap)# authe nticati on pre-share
routerB(config)# crypto isakmp key 123456 address 20.20.20.21
配置除了这里的对端IP地址变成了 20.20.20.21 ,其他都要一样的)。
(路由 B 和 A 的
2配置IPSec相关参数
routerA
routerA(cnfog)#crypto ipsec transform-set test
ah-md5-hamc esp-des (test 传输
)。
模式的名称。 ah-md5-hamc esp-des 表示传输模式中采用的验证和加密参数
routerA(config)# access-list 101 permit ip 192.168.1.0 0.0.0.255 192.168.2.0 0. 0.0.255 (定义哪些地址的报文加密或是不加密) routerB
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
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 地址)。 routerA(config-crypto-map)#set transform-set test
(指定此VPN链路,对端的IP
(IPSec 传输模式的名字)
routerA(config-crypto-map)#match address 101 routeB
routerB(config)# crypto map testmap 1 ipsec-isakmp routerB(config-crypto-map)# set peer 20.20.20.21 IP 不一样)
routerB(config-crypto-map)#set transform-set test routerB(config-crypto-map)#match address 101
(和A路由的配置只有这里的对端
( 上面定义的 ACL 列表号)
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
[此文档可自行编辑修改,如有侵权请告知删除,感谢您的支持,我们会努力把内容做得更 好]