6 楼说的没错,其实没封,是 NAT 穿透的问题,而 L2TP/IPSec 是可以开启 NAT 穿透的。贴一段
die.net 关于 IPSec.conf 配置文件的 man page
force_keepalive
whether to force sending NAT-T keep-alives to support NAT which are send to prevent the NAT router from closing its port when there is not enough traffic on the IPsec connection. Acceptable values are: yes and no (the default). This parameter may eventually become per-connection.
keep_alive
The delay (in seconds) for NAT-T keep-alive packets, if these are enabled using force_keepalive This parameter may eventually become per-connection.
来自
http://linux.die.net/man/5/ipsec.confforce_keepalive 和 keep_alive 这两个参数是默认不开启的, ipsec.conf 配置文件中没写入,要手动填入到 config setup 下。 keep_alive=yes ,而 keep_alive 并不是越小越好,估计在 5 到 10 秒之间,具体需要你自己试验。时间太长,连接会超时被关闭,太短会占用带宽影响正常通信。
当初读了好久的文档,才终于解决了这个问题,要是有用的话,求楼主给铜币啊😂