我已经使用以下脚本设置了一个 vpn 服务器https://github.com/hwdsl2/setup-ipsec-vpn。
我正在从我的 Mac 连接到在 Ubuntu 服务器上运行的个人 vpn。
3分30秒后断开连接。
以下是我从 Mac vpn 客户端日志中看到的内容:
tail -100f /var/log/ppp.log
Mon Apr 27 13:34:51 2020 : L2TP received StopCCN
Mon Apr 27 13:34:51 2020 : L2TP hangup
Mon Apr 27 13:34:51 2020 : ipcp: down
Mon Apr 27 13:34:51 2020 : Connection terminated.
Mon Apr 27 13:34:51 2020 : L2TP clearing port-mapping for en0
Mon Apr 27 13:34:51 2020 : Connect time 2.6 minutes.
Mon Apr 27 13:34:51 2020 : Sent 1028457 bytes, received 5762343 bytes.
Mon Apr 27 13:34:51 2020 : L2TP disconnecting...
Mon Apr 27 13:34:51 2020 : L2TP sent CDN
Mon Apr 27 13:34:51 2020 : L2TP sent StopCCN
Mon Apr 27 13:34:51 2020 : L2TP disconnected
以下是我在服务器端看到的内容:
tail -f /var/log/auth.log
Apr 27 10:34:20 ip-172-31-40-152 pluto[3459]: "l2tp-psk"[2] 149.0.138.78 #1: IKEv1 DPD action - clearing connection kind CK_INSTANCE
Apr 27 10:34:20 ip-172-31-40-152 pluto[3459]: "l2tp-psk" #2: deleting state (STATE_QUICK_R2) aged 120.084s and sending notification
Apr 27 10:34:20 ip-172-31-40-152 pluto[3459]: "l2tp-psk" #2: ESP traffic information: in=1MB out=6MB
Apr 27 10:34:20 ip-172-31-40-152 pluto[3459]: "l2tp-psk" #1: deleting state (STATE_MAIN_R3) aged 121.125s and sending notification
Apr 27 10:34:20 ip-172-31-40-152 pluto[3459]: "l2tp-psk"[2] 149.0.138.78: deleting connection "l2tp-psk"[2] 149.0.138.78 instance with peer 149.0.138.78 {isakmp=#0/ipsec=#0}
tail -f /var/log/syslog
Apr 27 10:52:03 ip-172-31-40-152 xl2tpd[3043]: Maximum retries exceeded for tunnel 39830. Closing.
Apr 27 10:52:03 ip-172-31-40-152 pppd[4266]: Modem hangup
Apr 27 10:52:03 ip-172-31-40-152 systemd-networkd[700]: ppp0: Link DOWN
Apr 27 10:52:03 ip-172-31-40-152 pppd[4266]: Connect time 3.6 minutes.
Apr 27 10:52:03 ip-172-31-40-152 systemd-networkd[700]: ppp0: Lost carrier
Apr 27 10:52:03 ip-172-31-40-152 pppd[4266]: Sent 94682 bytes, received 107101 bytes.
Apr 27 10:52:03 ip-172-31-40-152 systemd-timesyncd[526]: Network configuration changed, trying to establish connection.
Apr 27 10:52:03 ip-172-31-40-152 xl2tpd[3043]: Terminating pppd: sending TERM signal to pid 4266
Apr 27 10:52:03 ip-172-31-40-152 xl2tpd[3043]: Connection 24 closed to 149.0.138.78, port 59243 (Timeout)
Apr 27 10:52:03 ip-172-31-40-152 pppd[4266]: Connection terminated.
Apr 27 10:52:03 ip-172-31-40-152 pppd[4266]: Exit.
Apr 27 10:52:03 ip-172-31-40-152 systemd-timesyncd[526]: Synchronized to time server 91.189.91.157:123 (ntp.ubuntu.com).
服务器在 AWS 上运行。我尝试更改服务器 IP 地址,从映像重新创建服务器。但这些方法都不起作用。
(!) 以前我连接 vpn 服务器时没有遇到麻烦。更换 ISP 后,我开始遇到这个问题。ISP 支持人员不知道这个问题。
设置可能存在什么问题?
答案1
在尝试了一些配置更改之后/etc/ipsec.conf
,我发现增加 dpdtimeout 可以解决我的问题:
我将dpdtimeout
值从 120 更新为 1200。
dpdtimeout=1200
现在,我不再与 VPN 服务器断开连接了。