无法路由回从VPS的IPsec隧道

我试图build立一个从我们企业networking边缘的Draytek路由器到数字海洋上的VPS的IPsec VPN。 我已经在Ubuntu 14.04机器上使用这个脚本在VPS上设置了VPN。 我相信脚本下载并安装libreswan并提示一些基本的configuration问题等。我已经对脚本创build的ipsec.conf进行了一些更改。 我的问题是,我可以从路由器ping到VPS,我可以看到VPS上显示的数据包来自路由器的私有IP地址,但是我没有试过让我将数据包路由回隧道到路由器。 因此,从路由器的pov看来,ping是超时的。

路由器在其一个接口上直接连接到互联网,并configuration了本地IP地址10.111.1.1。 VPS有一个直接连接到互联网的接口。

当build立VPN时,这是VPS上的路由表:

Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface default 178.62.64.1 0.0.0.0 UG 0 0 0 eth0 10.111.1.1 * 255.255.255.255 UH 0 0 0 eth0 178.62.64.0 * 255.255.192.0 U 0 0 0 eth0 

注意,第二个条目是在build立VPN时创build的。

如果我试着ping 10.111.1.1,我得到:

 PING 10.111.1.1 (10.111.1.1) 56(84) bytes of data. From <public IP address - eth0> icmp_seq=1 Destination Host Unreachable 

这是来自ipsecvalidation的输出:

 Verifying installed system and configuration files Version check and ipsec on-path [OK] Libreswan 3.10 (netkey) on 3.13.0-37-generic Checking for IPsec support in kernel [OK] NETKEY: Testing XFRM related proc values ICMP default/send_redirects [OK] ICMP default/accept_redirects [OK] XFRM larval drop [OK] Pluto ipsec.conf syntax [OK] Hardware random device [N/A] Two or more interfaces found, checking IP forwarding [OK] Checking rp_filter [OK] Checking that pluto is running [OK] Pluto listening for IKE on udp 500 [OK] Pluto listening for IKE/NAT-T on udp 4500 [OK] Pluto ipsec.secret syntax [OK] Checking 'ip' command [OK] Checking 'iptables' command [OK] Checking 'prelink' command does not interfere with FIPSChecking for obsolete ipsec.conf options [OK] Opportunistic Encryption [DISABLED] 

这里是/etc/ipsec.conf的内容(注释掉的行是以前实验结果相同的结果):

 version 2.0 config setup dumpdir=/var/run/pluto/ nat_traversal=yes virtual_private=%v4:10.0.0.0/8,%v4:192.168.0.0/16,%v4:172.16.0.0/12,%v4:!192.168.42.0/24 oe=off protostack=netkey nhelpers=0 interfaces=%defaultroute conn vpnpsk connaddrfamily=ipv4 auto=add left=178.62.73.215 # leftid=178.62.73.215 # leftsubnet=178.62.73.215/32 leftsubnet=10.10.10.0/24 # leftnexthop=%defaultroute leftnexthop=%direct leftprotoport=17/1701 rightprotoport=17/%any # right=%any right=10.111.1.0/24 rightsourceip=10.111.1.1 leftsourceip=10.10.10.1 # rightsubnetwithin=0.0.0.0/0 forceencaps=yes authby=secret pfs=no type=transport auth=esp ike=3des-sha1,aes-sha1 phase2alg=3des-sha1,aes-sha1 rekey=no keyingtries=5 dpddelay=30 dpdtimeout=120 dpdaction=clear 

这是来自路由器的路由表的相关部分:

 Key: C - connected, S - static, R - RIP, * - default, ~ - private * 0.0.0.0/ 0.0.0.0 via <public IP address> WAN2 S~ 10.10.10.0/ 255.255.255.0 via 178.62.73.215 VPN-10 C~ 10.111.1.0/ 255.255.255.0 directly connected LAN C <public IP address>/ 255.255.255.224 directly connected WAN2 

希望有人指出我做错了什么。

谢谢。

好吧,我已经通过删除leftprotoport = 17/1701和rightprotoport = 17 /%任何一行来偶然发现解决scheme。 不知道为什么这个工作买嘿嘿! 我现在可以从服务器ping到路由器,并可以ping设备挂在路由器上。 现在我又遇到了另外一个问题,但是我会再提出一个问题。 谢谢大家。