当前位置:文档之家› ipsec-vpn配置实例

ipsec-vpn配置实例

网络拓扑
环境:接口地址都已经配置完,路由也配置了,双方可以互相通信了
密钥认证的算法2种:md5和sha1
加密算法2种: des和3des
IPsec传输模式3种:
AH验证参数:ah-md5-hmac(md5验证)、ah-sha-hmac(s ha1验证)
ESP加密参数:esp-des(des加密)、esp-3des(3des 加密)、esp-null(不对数据进行加密)
ESP验证参数:esp-md5-hmac(md5验证)、esp-sha-h mac(采用sha1验证)
1 启用IKE协商
routerA
routerA(config)#crypto isakmp policy 1
建立IKE协商策略(1是策略编号1-1000,号越小,优先级越高
routerA(config-isakmap)#hash md5 密钥认证的算法
routerA(config-isakmap)#authentication pre-sh are告诉路由使用预先共享的密钥
routerA(config)#crypto isakmp key 123456 addr ess 20.20.20.22 (123456是设置的共享密20.2 0.20.22是对端的IP地址)。

routerB
routerB(config)#crypto isakmp policy 1
routerB(config-isakmap)#hash md5
routerB(config-isakmap)#authentication pre-sh are
routerB(config)#crypto isakmp key 123456 addr ess 20.20.20.21 (路由B和A的配置除了这里的对端IP地址变成了20.20.20.21,其他都要一样的)。

2 配置IPSec相关参数
routerA
routerA(cnfog)#crypto ipsec transform-set tes
t ah-md5-hamc esp-des (test传输模式的名称。

a h-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 te st ah-md5-hamc esp-des
routerB(config)#acess-list 101 permit ip 192.1 68.2.0 0.0.0.255 192.168.1.0 0.0.0.255(路由器B和A的配置除了这里的源和目的IP地址变了,其他都一样)
3设置crypto map (目的把IKE的协商信息和IPSe c的参数,整合到一起,起一个名字)
routerA
routerA(config)#crypto map testmap 1 ipsec-isa kmp (testmap:给crypto map起的名字。

1:优先级。

ipsec-isakmp:表示此IPSec链接采用IKE自动协商)
routerA(config-crypto-map)#set peer 20.20.20.2 2 (指定此VPN链路,对端的IP地址)。

routerA(config-crypto-map)#set transform-set t est (IPSec传输模式的名字)
routerA(config-crypto-map)#match address 10
1 (上面定义的ACL列表号)
routeB
routerB(config)#crypto map testmap 1 ipsec-isa kmp
routerB(config-crypto-map)#set peer 20.20.20.2 1 (和A路由的配置只有这里的对端IP不一样)routerB(config-crypto-map)#set transform-set t est
routerB(config-crypto-map)#match address 101
4 把crypto map 的名字应用到端口
routerA(config)#inter s0/0 (进入应用VPN的接口)
routerA(config-if)#crypto map testmap (testm ap:crypto map的名字)
B路由和A完全一样。

查看VPN的配置
查看安全联盟(SA)
Router#show crypto ipsec sa
显示crypto map 内的所有配置router#show crypto map
查看优先级
router#show crypto isakmp policy。

相关主题