不活动时重新启动 OpenVPN systemctl 服务

不活动时重新启动 OpenVPN systemctl 服务

我在使用 systemctl service restart 时遇到了问题。我设置了一个 OpenVPN 服务,从系统开始,使用


[Unit]
# HTPC Guides - www.htpcguides.com
Description=OpenVPN connection to %i
Documentation=man:openvpn(8)
Documentation=https://community.openvpn.net/openvpn/wiki/Openvpn23ManPage
Documentation=https://community.openvpn.net/openvpn/wiki/HOWTO
After=network.target

[Service]
RuntimeDirectory=openvpn
PrivateTmp=true
KillMode=mixed
Type=forking
ExecStart=/usr/sbin/openvpn --daemon ovpn-%i --status /run/openvpn/%i.status 10 --cd /etc/openvpn --script-security 2 --config /etc/openvpn/%i.conf --writepid /run/openv$
PIDFile=/run/openvpn/%i.pid
ExecReload=/bin/kill -HUP $MAINPID
WorkingDirectory=/etc/openvpn
Restart=on-failure
RestartSec=10
StartLimitInterval=0
ProtectSystem=yes
LimitNPROC=10
DeviceAllow=/dev/null rw
DeviceAllow=/dev/net/tun rw

[Install]
WantedBy=multi-user.target

但是,每次网络连接中断时,当网络恢复时,systemctl status 都会显示以下内容:

[email protected] - OpenVPN connection to openvpn
   Loaded: loaded (/etc/systemd/system/[email protected]; enabled; vendor
   Active: inactive (dead) since sze 2019-05-29 20:14:30 CEST; 11min ago
     Docs: man:openvpn(8)
           https://community.openvpn.net/openvpn/wiki/Openvpn23ManPage
           https://community.openvpn.net/openvpn/wiki/HOWTO
  Process: 18765 ExecStart=/usr/sbin/openvpn --daemon ovpn-%i --status /run/open
 Main PID: 18773 (code=exited, status=0/SUCCESS)

máj 29 20:12:49 SeedBox ovpn-openvpn[18773]: Authenticate/Decrypt packet error:
máj 29 20:12:49 SeedBox ovpn-openvpn[18773]: Authenticate/Decrypt packet error:
máj 29 20:12:49 SeedBox ovpn-openvpn[18773]: Authenticate/Decrypt packet error:
máj 29 20:12:49 SeedBox ovpn-openvpn[18773]: Authenticate/Decrypt packet error:
máj 29 20:12:49 SeedBox ovpn-openvpn[18773]: Authenticate/Decrypt packet error:
máj 29 20:12:49 SeedBox ovpn-openvpn[18773]: Authenticate/Decrypt packet error:
máj 29 20:14:30 SeedBox ovpn-openvpn[18773]: [openvpn2.vpnunlimitedapp.com] Inac
máj 29 20:14:30 SeedBox ovpn-openvpn[18773]: /sbin/ip addr del dev tun0 local 10
máj 29 20:14:30 SeedBox ovpn-openvpn[18773]: /etc/openvpn/update-resolv-conf tun
máj 29 20:14:30 SeedBox ovpn-openvpn[18773]: SIGTERM[soft,ping-exit] received, p
lines 1-19/19 (END)

但是当我systemctl restart service一切正常时,我想我没有正确配置重启。

我应该改变什么?

谢谢

答案1

我会尝试添加建议的标志之一这个问题。好像是类似的问题,试试看?

相关内容