我已经configuration了两个Linux机器,以便他们在需要通信时自动使用传输级别的IPSec连接。 configuration基于带有X509authentication的Racoon,并且bundle_complex选项设置为on ,以及两个框之间需要ESP和AH的策略。
虽然configuration工作,一般来说,前几个数据包总是丢失,例如:
$ ping -c 3 ABCD PING ABCD (ABCD) 56(84) bytes of data. ping: sendmsg: Operation not permitted ping: sendmsg: Operation not permitted 64 bytes from ABCD: icmp_req=3 ttl=64 time=0.497 ms
有什么办法可以防止这种情况发生,例如通过“延迟”数据包直到IPSec传输协商完毕?
第一个数据包(以及所有其他数据直到协商完成)总是被丢弃。
我已经处理的每个ISAKMP实现都是如此。 我不相信有什么理由不能缓冲被丢弃的数据包, 相反,它不应该 。
这是互联网路由基础架构中有意识的devise决策的延伸: 不要持有数据包 。
互联网上的路由系统总是丢弃一个数据包,而不是延迟它,当他们不能(几乎)立即路由它。 整个互联网上的数据包丢失可以通过简单地保持一个数据包缓冲直到有空间来容易地降低到更低的水平。 但是,问题就在于此。 在先进先出队列中运行200毫秒的超载路由器会延迟每一个200毫秒的数据包。
把它带回到ISAKMP的情况; 持有几个ping直到path准备好进行它们是伟大的,但如果它是成千上万的UDP数据包的恒定stream? 而如果远程系统不可访问,那么ISAKMP在那里等待60秒的ISAKMP协商消息2呢?
虽然这些并不是不可克服的工程问题,但是互联网工程界的传统观点是,客户系统本身主要通过使用诸如TCP的容错协议来处理丢包问题变得简单和容易。
您可以在任何stream量开始stream动之前自动启动IPSEC隧道(通常是那些首先丢弃的数据包启动IKE协商)。 这是如何与StrongSwan做到这一点:
auto = ignore | add | route | start what operation, if any, should be done automatically at IPsec startup; currently-accepted values are add, route, start and ignore (the default). add loads a connection without starting it. route loads a connection and installs kernel traps. If traffic is detected between leftsubnet and rightsubnet , a con‐ nection is established. start loads a connection and brings it up immediatly. ignore ignores the connection. This is equal to delete a connection from the config file. Relevant only locally, other end need not agree on it (but in general, for an intended-to-be-permanent connection, both ends should use auto=start to ensure that any reboot causes immediate renegotia‐ tion).
虽然我还没有想出如何与浣熊做同样的事情,但我想也应该有类似的东西。