昨天我在 Ubuntu 18.04 服务器上配置了 OpenVPN,这似乎可以工作。我可以毫无问题地连接并systemctl status openvpn
给我绿色。然而,我的系统日志充满了错误,这些错误似乎与不同的服务相关openvpn.service
。我对此感到有点不安,因为服务器明天将投入使用,而访问的唯一方法是通过 openvpn。
这是系统日志:
Jun 22 15:30:41 localhost systemd[1]: [email protected]: Main process e xited, code=exited, status=1/FAILURE
Jun 22 15:30:41 localhost systemd[1]: [email protected]: Failed with re sult 'exit-code'.
Jun 22 15:30:41 localhost systemd[1]: Failed to start OpenVPN connection to multi-user.
Jun 22 15:30:47 localhost systemd[1]: [email protected]: Service hold-off time over, scheduling restart.
Jun 22 15:30:47 localhost systemd[1]: [email protected]: Scheduled restart job, restart counter is at 146.
Jun 22 15:30:47 localhost systemd[1]: Stopped OpenVPN connection to multi-user.
Jun 22 15:30:47 localhost systemd[1]: Starting OpenVPN connection to multi-user...
Jun 22 15:30:47 localhost ovpn-multi-user[3046]: Options error: In [CMD-LINE]:1:Error opening configuration file: /etc/openvpn/multi-user.conf
Jun 22 15:30:47 localhost ovpn-multi-user[3046]: Use --help for more information.
Jun 22 15:30:47 localhost systemd[1]: [email protected]: Main process exited, code=exited, status=1/FAILURE
Jun 22 15:30:47 localhost systemd[1]: [email protected]: Failed with result 'exit-code'.
Jun 22 15:30:47 localhost systemd[1]: Failed to start OpenVPN connection to multi-user.
Jun 22 15:30:52 localhost systemd[1]: [email protected]: Service hold-off time over, scheduling restart.
Jun 22 15:30:52 localhost systemd[1]: [email protected]: Scheduled restart job, restart counter is at 147.
Jun 22 15:30:52 localhost systemd[1]: Stopped OpenVPN connection to multi-user.
Jun 22 15:30:52 localhost systemd[1]: Starting OpenVPN connection to multi-user.
答案1
我最初通过将以下行放入我的中来解决这个问题rc.local
:
systemctl stop [email protected]
我最终通过禁用已弃用的[email protected]
、从 OpenVPN 根目录中删除所有配置文件并将它们移动到服务器目录以及激活相应的来解决这个问题[email protected]
。
答案2
在 systemd 下,至少在 Debian(大概还有 Ubuntu)上,每个 VPN 连接(可以有多个)都有自己的服务名称[email protected]
。 .*.conf
中的每个文件应该有一个/etc/openvpn/
。
实际上openvpn.service
是所有这些的集合,让您可以轻松地立即启动/停止/重新加载所有 VPN。获得它的状态并不能告诉你有多大用处。
因此,您需要尝试或,因为您的 VPN 似乎由于某种原因正在退出。当然,这可能是一些简单且预期的事情,例如网络问题、远程端断开连接等。(OpenVPN 可以配置为在 VPN 出现故障时退出。)systemctl status [email protected]
journalctl [email protected]
systemctl list-units | grep openvpn
您可以使用类似或可能的内容查看所有 OpenVPN 单元systemctl show --property ConsistsOf openvpn.service