2023年11月24日发(作者:)

Site to site vpn 的配置

一、 实验拓扑图

二、实验的配置步骤

安装以上拓扑图,配置好相应的配置后,进行以下的配置:

1..安装IPsec VPN模块。

2.启用VPN功能:

Securve(config)# ip crypto

3.创建一条IKE策略,设置优先级为10

Securve(config)# crypto ike policy 10

4.配置发起模式为主动:Securve(config-crypto-ike)# initiate main

5.设置相应的方式:Securve(config-crypto-ike)# respond anymode

6.设置VPN对端IPSecurve(config-crypto-ike)# peer 59.71.15.90

另外一个路由器设置为client(config-crypto-ike)# peer 59.71.9.3

7.创建一条属性策略:Securve(config-ike)# attribute 10

8.设置属性中的认证、加密、哈希算法,有效期和DH算法组:

Securve(config-ike-attribute)# authentication pre-share (认证算法为pre-share

Securve(config-ike-attribute)# encryption 3des(加密算法为3DES

Securve(config-ike-attribute)# hash sha(完整性校验算法为SHA-1

Securve(config-ike-attribute)# lifetime 600IKE SA的有效期位600秒)

Securve(config-ike-attribute)# group 1(对称密钥协商算法为Diffle-Hellman第二组)

9.退到普通配置模式,设置IPsec SA报文的变化方式:

Securve(config)# crypto ipsec transform-set highly esp-3des esp-sha-hmac

10.设置传输模式为隧道模式:

Securve(cfg-crypto-trans)# mode tunnel

11.创建一条隧道的ACL

a. Securve(config)# ip access-list extended vpn

b. Securve(config-ext-nacl)# permit ip 10.1.1.0 0.0.0.255 192.168.1.0 0 0.0.0.255

另外一个路由器上设置为: client(config-ext-nacl)# permit ip 192.168.1.0 0.0.0.255 10.1.1.0 0.0.0.255

12. 创建一条加密映射条目:

Securve(config)# crypto map corporate 1 ipsec-ike (创建索引号为0使用IKE的加密条目)

Securve(config-crypto-map)# set peer 59.71.15.90(该条目的对端IP地址)

另外一个路由器设置为client(config-crypto-map)# set peer 59.71.9.3(该条目的对端IP地址)

Securve(config-crypto-map)# set transform-set highly

Securve(config-crypto-map)# match address vpnL (设置匹配的acl

Securve(config-crypto-map)# set security-association lifetime 1800 (设置ipsec安全关联存活期)

13.退出到普通设置模式,设置VPN对端预共享密钥:

Securve(config)# crypto ike remote-id address 59.71.9.3 preshared-key procurve

14.设置pfs

Securve(config)# no set pfs

14.将加密映射应用到WAN接口:

Securve(config)# int eth 0/1

Securve(config-ppp 1)# crypto map VPN

15.保存配置:

Securve(config)# write memory

三、运行结果

ip address10.1.1.3电脑上ping 192.168.1.3,结果如下图所示,可以正常通信,证明vpn通道已经建立。

如果不能通信,由于没有配置防火墙策略,可以在路由器上关闭防火墙

Securve(config)# no ip firewall

如果还不能通信,请在全局模式下使用show crypto map sa查看是否出现如下类似的数据:

securve#show crypto ipsec sa

Using 2 SAs out of 4000

IPSec Security Associations:

Peer IP Address: 59.71.9.3

Remote ID: 59.71.15.90

Crypto Map: corporate 1

Direction: Inbound

Encapsulation: ESP

SPI: 0xD281FB6A (3531733866)

RX Bytes: 3016637

Selectors: Src:192.168.1.0/255.255.255.0 Port:ANY Proto:ALL IP

Dst:10.1.1.0/255.255.255.0 Port:ANY Proto:ALL IP

Hard Lifetime: 1500

Soft Lifetime: 0

Out-of-Sequence Errors: 0

Peer IP Address: 59.71.15.90

Remote ID: 59.71.15.90

Crypto Map: corporate 1

Direction: Outbound

Encapsulation: ESP

SPI: 0xA9C5565C (2848282204)

TX Bytes: 57715

Selectors: Src:10.1.1.0/255.255.255.0 Port:ANY Proto:ALL IP

Dst:192.168.1.0/255.255.255.0 Port:ANY Proto:ALL IP

Hard Lifetime: 1500

Soft Lifetime: 1440

请检查加密映射条目是否配置正确,示例如下:

securve#show crypto map

Crypto Map "corporate" 1 ipsec-ike

Extended IP access list vpn

Peers:

59.71.15.90

Transform sets:

highly

Security-association lifetimes:

0 kilobytes

1800 seconds

No PFS group configured

Anti-replay checking enabled

Commit bit in use

Idle Timeout: disabled

Reverse Route Inject disabled

Interfaces using crypto map corporate:

eth 0/1

四、配置文件

Client的配置文件

!

!

! ProCurve Secure Router 7102dl SROS version J08.03

! Boot ROM version J06.06

! Platform: ProCurve Secure Router 7102dl, part number J8752A

! Serial number US520UA591

! Flash: 33554432 bytes DRAM: 134217727 bytes

! Date/Time: Fri Apr 05 2002, 04:37:39 UTC

!

!

hostname "client"

enable password procurve

!

!

ip crypto

!

crypto ike policy 10

initiate main

respond anymode

peer 59.71.9.3

attribute 10

encryption 3des

authentication pre-share

lifetime 600

!

crypto ike remote-id address 59.71.9.3 preshared-key procurve

!

crypto ipsec transform-set highly esp-3des esp-sha-hmac

mode tunnel

!

crypto map corporate 1 ipsec-ike

match address vpn

set peer 59.71.9.3

no ip address

no shutdown

!

!

!

!

!

!

!

!

ip access-list extended vpn

permit ip 192.168.1.0 0.0.0.255 10.1.1.0 0.0.0.255

no login

!

line telnet 0 4

login

password procurve

no shutdown

line ssh 0 4

login local-userlist

no shutdown

!

!

End

Sercurve的配置文件

!

!

! ProCurve Secure Router 7102dl SROS version J08.03

! Boot ROM version J06.06

! Platform: ProCurve Secure Router 7102dl, part number J8752A

! Serial number US520UA100

!

!

!

!

no autosynch-mode

no safe-mode

!

!

!

!

!

!

!

ip crypto

!

crypto ike policy 10

initiate main

respond anymode

ip address 10.1.1.1 255.255.255.0

no shutdown

!

!

!

!

interface e1 1/1

shutdown

!

!

!

!

!

!

!

!

ip access-list extended vpn

permit ip 10.1.1.0 0.0.0.255 192.168.1.0 0.0.0.255

!

!

!

!

line con 0

no login