20
2019
03
11:10:57

莫名其妙的 unable to install inbound and outbound IPsec SA (SAD) in kernel



推荐点击下面图片,通过本站淘宝优惠价购买:

image.png

arsed QUICK_MODE response 1206673144 [ HASH SA No KE ID ID ] received netlink error: No such file or directory (2) unable to add SAD entry with SPI cf94fd61 received netlink error: No such file or directory (2) unable to add SAD entry with SPI 939a5d3b unable to install inbound and outbound IPsec SA (SAD) in kernel


本来配置是好好的,也连了2天正常的ipsec vpn,突然就来了一个 unable to install inbound and outbound IPsec SA (SAD) in kernel

官方找到了这个 https://wiki.strongswan.org/issues/557    https://wiki.strongswan.org/issues/920 

另外网站找到了这个 https://serverfault.com/questions/851933/unable-to-install-inbound-and-outbound-ipsec-sa-sad-in-kernel    (谷歌才能搜索出更精确的东西,百度搜索不出来,哎)


 kernel-libipsec plugin 引起的问题,卸载了, 只安装 strongswan-mod-kernel-netlink 就好


https://forum.turris.cz/t/strongswan-error-unable-to-install-inbound-and-outbound-ipsec-sa-sad-in-kernel/987/14   另外一个却说没安装  kernel-libipsec plugin 引起的,安装了就好,奇葩咯。不知道了,反正继续观察。


今天发现又连不上了,重新启动tunnel后,360防火墙能ping通openwrt,以为就解决了,结果发现在openwrt ping回360不通了,并且ifconfig -a,连ipsec00的接口都不见了,我草,原来 kernel-libipsec就是为了创建一个ipsec0的接口,这样web界面就可以找到这个接口做防火墙配置。

但现在如果tunnel在360防火墙显示连上,可是openwrt连不回啊,这可不行。安装回kernel-libipsec插件,但启动ipsec提示IPsec SA: only UDP encapsulation is supported ,去官网查wiki

在看这几个文章,再重新思考一下

https://wiki.strongswan.org/issues/920

https://wiki.strongswan.org/issues/530 

https://wiki.strongswan.org/issues/2964 

https://wiki.strongswan.org/issues/2726 

http://lax.v2ex.com/t/158012 

https://wiki.strongswan.org/projects/strongswan/wiki/NatTraversal 

ipsec.conf

nat_traversal = yes  我并未开启和使用,而且我用的5.13已经取消

也可能是我手贱启动了这个 ---- 我记得之前也是启动也没问题啊

leftfirewall=yes 

把360防火墙的 nat穿越打开,360删除重置隧道,openwrt重新启动ipsec服务

一切恢复正常,ipsec0有流量,并且可以配置到防火墙


附上op的配置

config setup

         uniqueids = never


conn %default

 authby=psk

 type=tunnel

 ike=aes-sha1-modp1024!

 ikelifetime=3600s

 esp=aes-sha1-modp1024!

 lifetime=3600s

 aggressive=yes


conn net-net

 keyexchange=ikev1

 left=%any

 leftsubnet=192.168.*.0/24

 leftid=@op.*.cn

 leftfirewall=yes

 right=112.94.4.17

 rightsubnet=192.168.*.0/22

 rightid=@360.*.cn

 auto=start

 type=tunnel


再附上一个自动down up 隧道的脚本,测试是可用的,但长久不知道效果如何。

!/bin/sh

line="0"

total="0"

dst=192.168.*.1


 while [ 1 ]; do

          line=`ping $dst -c 1 -s 1 -W 1 | grep "100% packet loss" | wc -l`

          if [ "${line}" != "0" ]; then

                total=$((total+1))

          else

                total="0"

           fi


           if [ "${total}" == "5" ]; then

                      ipsec down net-net

                      ipsec up net-net

            fi

                        sleep 10

 done



继续观察稳定性吧....

linux net2net已经实现,由于是固定IP,所以挺稳定,但通后nat问题还没研究仔细。

后面准备计划跟pfsense打通ipsecvpn,理论上应该没问题的。



发现上面的脚本,重新启动后,内网会上不了网,还是再看看有没有其它方案吧。

本文链接:https://hqyman.cn/post/395.html 非本站原创文章欢迎转载,原创文章需保留本站地址!

分享到:





休息一下,本站随机推荐观看栏目:


« 上一篇 下一篇 »

评论列表:

楼主,我现在用openwrt和hillstone之间起IPsec,net2net,在openwrt端也出现这个错误
IPsec SA: only UDP encapsulation is supported
我的配置文件里并没有leftfirewall=yes
看了您的文章,没搞懂具体应该怎样解决这个错误
是我strongswan扩展到底要不要kernel-libipsec插件?
版本不一样,有些配置会不一样。建议版本要2020年哪个版本,具体我忘记了
kernel-libipsec安装,并且不要开启leftfirewall=yes

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

您的IP地址是: