试图从OpenSWAN复制一个可用的IPSec / L2TPconfiguration到StrongSWAN

我有一个适用于RA的OpenSWAN实现,使用在AWS中运行的IPsec传输和l2tp作为通道。 这个实例有一个私有的IP,并且映射到一个公共的EIP。

我使用leftleft leftsubnet参数的私有IP和公共leftid

我正在尝试configuration从同一个客户端到运行StrongSWAN(4.5.2)的新端点的IPSec连接。 我试图尽可能地将configuration从openswan复制到strongswan。 现在,我只是试图build立IPSec(不用担心l2tp),并且在第二阶段(阶段1正在完成)遇到问题。

configuration的差异是:

 --- openswan.conf 2014-07-18 11:48:01.740966015 +0200 +++ strongswan.conf 2014-07-18 11:46:58.927569703 +0200 @@ -1,11 +1,14 @@ +version 2.0 + config setup - protostack=netkey + charonstart=no + interfaces="%none" nat_traversal=yes - virtual_private=%v4:192.168.10.0/24 oe=off - nhelpers=0 - interfaces=%defaultroute + virtual_private="%v4:192.168.11.0/24" + +conn %default + keyexchange=ikev1 conn remote-access forceencaps=yes type=transport ike=3des-sha1 - phase2alg=3des-sha1 

当我从客户端调出连接时,我得到以下信息:

 003 "myconn" #1: NAT-Traversal: Result using RFC 3947 (NAT-Traversal): both are NATed 108 "myconn" #1: STATE_MAIN_I3: sent MI3, expecting MR3 004 "myconn" #1: STATE_MAIN_I4: ISAKMP SA established {auth=OAKLEY_PRESHARED_KEY cipher=aes_128 prf=oakley_sha group=modp2048} 117 "myconn" #2: STATE_QUICK_I1: initiate 

并在服务器日志中

 "remote-access"[3] 105.1.1.1 #2: NAT-Traversal: Result using RFC 3947: both are NATed "remote-access"[3] 105.1.1.1 #2: Peer ID is ID_IPV4_ADDR: '192.168.2.2' "remote-access"[4] 105.1.1.1 #2: deleting connection "remote-access" instance with peer client.ip.addr {isakmp=#0/ipsec=#0} "remote-access"[4] 105.1.1.1:4500 #2: sent MR3, ISAKMP SA established "remote-access"[4] 105.1.1.1:4500 #2: cannot respond to IPsec SA request because no connection is known for 54.1.1.1/32===10.0.0.2:4500[54.1.1.1]:17/1701...105.1.1.1.1:4500[192.168.2.2]:17/%any==={192.168.2.2/32} "remote-access"[4] 105.1.1.1:4500 #2: sending encrypted notification INVALID_ID_INFORMATION to 105.1.1.1:4500 

192.168.2.2是客户端的私有IP,105.1.1.1是获得NAT的公有IP。

我已经search了“无法响应IPsec SA请求,因为没有连接是已知的”,只有拿出1有关strongswan在https://lists.strongswan.org/pipermail/users/2011-July/001885.html ,而且这两个build议都不起作用(调整peer的rightid或在strongswan服务器上添加leftsourceip)。

我连接到strongswan的peer / client是libreswan 3.7

编辑这里的configuration

EC中的StrongSWAN:

conn remote-access authby=secret pfs=no left=10.0.0.2 leftid=54..1.1.1 leftsubnet=10.0.0.2/32 leftnexthop=%defaultroute leftprotoport=17/1701 right=%any rightid=%any rightsubnetwithin=0.0.0.0/0 rightprotoport=17/%any type=transport forceencaps=yes auto=add ike=3des-sha1 dpddelay=15 dpdtimeout=45 dpdaction=clear auth=esp esp=aes256-sha1,3des-sha1!

此主机上的秘密文件:

 54.1.1.1 %any : PSK "XXX" 

我的本地RA客户端configuration:

conn myconn authby=secret pfs=no rekey=yes keyingtries=3 type=transport left=%defaultroute leftprotoport=17/1701 right=54.1.1.1 rightprotoport=17/1701 auto=add phase2=esp phase2alg=3des-md5;modp1024 forceencaps=yes

秘密:

 0.0.0.0 %any 54.1.1.1 : PSK "XXX" 

我最近在本地客户端添加了phase2参数和forceencaps。

之前显示的差异是在我连接的2个基于EC2的主机之间。 “myconn”连接来自我的工作站,我有两个conns,一个用于openswan peer(工作),另一个用于strongswan peer(不是)。 我认为使用相同的方法左/右configuration将导致工作configuration。

这是一个使用openswan的工作configuration。 一些影响获得这个configuration工作的参数是使用了rightsubnetwithinphase2alg (phase2alg可以根据需要进行调整,我最初使用3des-sha1,但稍后调整)。

示例configuration

/etc/ipsec.conf

 config setup plutostderrlog= "/var/log/pluto.err" protostack=netkey nat_traversal=yes virtual_private=%v4:192.168.10.0/24 oe=off nhelpers=0 interfaces=%defaultroute conn remote-access auto=add left=10.0.0.2 leftid=54.1.1.1 leftsubnet=10.0.0.2/32 leftnexthop=%defaultroute leftprotoport=17/1701 rightprotoport=17/%any right=%any rightid=%any rightsubnetwithin=0.0.0.0/0 forceencaps=yes authby=secret pfs=no type=transport auth=esp ike=3des-sha1 phase2alg=3des-sha1 dpdaction=clear dpddelay=60 dpdtimeout=500 

/etc/ipsec.secrets

 54.1.1.1 %any : PSK "Your_PSK" 

那得到了IPSec传输。

如果我理解正确,这里的一个或两个端点都有NAT设备后面的RFC1918地址。

你可以在我早期的答案中阅读更多的细节,但结果是它打破了conf文件的对称性。 而不是每一方都有相同的left=right= endpoints,并让SWAN分清哪个是哪个,每个方必须有自己的私有 IP地址, 另一方是公共的 。 在任何给定的结局上left哪一个都是right ,但是这两个地址将不同于另一个。

你没有发布你的实际.conf文件,只有差异,所以我不能进一步评论,但我非常强烈地怀疑这是问题。