网络通信 频道

实例剖析:采用路由器建立VPN网络

四. 配置ESP-DES IPSec并测试

---- 以下配置是配置VPN的关键。首先,VPN隧道只能限于内部地址使用。如果有更多的内部网络,可在此添加相应的命令。

---- huadong(config)#access-list 105 permit ip 172.17.1.0 0.0.0.255 172.16.0.0 0.0.255.255

---- huadong(config)#access-list 106 permit ip 172.17.1.0 0.0.0.255 172.17.2.0 0.0.0.255

---- huadong(config)#access-list 107 permit ip 172.17.1.0 0.0.0.255 172.17.3.0 0.0.0.255


---- 指定VPN在建立连接时协商IKE使用的策略。方案中使用sha加密算法,也可以使用md5算法。在IKE协商过程中使用预定义的码字。

---- huadong(config)#crypto isakmp policy 10

---- huadong(config-isakmp)#hash sha

---- huadong(config-isakmp)#authentication pre-share

---- huadong(config-isakmp)#exit


---- 针对每个VPN路由器,指定预定义的码字。可以一样,也可以不一样。但为了简明起见,建议使用一致的码字。

---- huadong(config)#crypto isakmp key abc2001 address 211.157.243.130

---- huadong(config)#crypto isakmp key abc2001 address 202.96.209.165

---- huadong(config)#crypto isakmp key abc2001 address 192.18.97.241


---- 为每个VPN(到不同的路由器,建立不同的隧道)制定具体的策略,并对属于本策略的数据包实施保护。本方案包括3个VPN隧道。需要制定3个相应的入口策略(下面只给出1个)。

---- huadong(config)#crypto map abc 20 ipsec-isakmp

---- huadong(config-crypto-map)#set peer 211.157.243.130

---- huadong(config-crypto-map)#set transform-set abc-des

---- huadong(config-crypto-map)#match address 105

---- huadong(config-crypto-map)#exit


---- 使用路由器的外部接口作为所有VPN入口策略的发起方。与对方的路由器建立IPSec。

---- huadong(config)#crypto map abc local-address serial0


---- IPSec使用ESP-DES算法(56位加密),并带SHA验证算法。

---- huadong(config)#crypto ipsec transform-set abc-des esp-des esp-sha-hmac


---- 指明串口使用上述已经定义的策略。

---- huadong(config)#inter serial0/0

---- huadong(config-if)#crypto map abc


---- 在IP地址为172.17.1.100的计算机上验证:

---- c:>ping 172.16.1.100

---- ……

---- Reply from 172.16.1.100: bytes=32 time=17ms TTL=255

---- ……

---- huadong#show crypto engine conn acti

---- ID Interface IP-Address State Algorithm Encrypt Decrypt

---- 1 < none > < none > set HMAC_SHA+DES_56_CB 0 0

---- 2000 Serial0/0 210.75.32.9 set HMAC_SHA+DES_56_CB 0 452

---- 2001 Serial0/0 210.75.32.9 set HMAC_SHA+DES_56_CB 694 0

---- 同时,这种连接使用了IPSec,而没有使用NAT技术。

0
相关文章