OpenVPN 系統日誌充滿錯誤,但其他方面似乎完美無缺
昨天我在 Ubuntu 18.04 伺服器上配置了 OpenVPN,這似乎可以工作。我可以連接沒有問題,
systemctl status openvpn
給我綠色。但是,我的系統日誌充滿了錯誤,這些錯誤似乎與openvpn.service
. 我對此有點不安,因為伺服器明天將投入使用,然後訪問的唯一方法是通過 openvpn。這是系統日誌:
Jun 22 15:30:41 localhost systemd[1]: openvpn@multi-user.service: Main process e xited, code=exited, status=1/FAILURE Jun 22 15:30:41 localhost systemd[1]: openvpn@multi-user.service: 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]: openvpn@multi-user.service: Service hold-off time over, scheduling restart. Jun 22 15:30:47 localhost systemd[1]: openvpn@multi-user.service: 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]: openvpn@multi-user.service: Main process exited, code=exited, status=1/FAILURE Jun 22 15:30:47 localhost systemd[1]: openvpn@multi-user.service: 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]: openvpn@multi-user.service: Service hold-off time over, scheduling restart. Jun 22 15:30:52 localhost systemd[1]: openvpn@multi-user.service: 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.
我最初通過在我的以下行中解決了這個問題
rc.local
:systemctl stop openvpn@multi-user.service
我終於通過禁用已棄用的
openvpn@.service
. 文件,從 OpenVPN 根目錄中刪除所有配置文件並將它們移動到伺服器目錄,以及啟動相應的openvpn-server@config.service
.
在 systemd 下,至少在 Debian(可能是 Ubuntu)上,每個 VPN 連接(可以有多個)都有自己的服務名稱
openvpn@CONNECTION-NAME.service
。您應該*.conf
在/etc/openvpn/
.實際
openvpn.service
是所有這些的集合,讓您輕鬆地一次啟動/停止/重新載入所有 VPN。獲得它的狀態並不能告訴你有多大用處。因此,您需要嘗試
systemctl status openvpn@multi-user.service
或journalctl _SYSTEMD_UNIT=openvpn@multi-user.service
,因為看起來您的 VPN 出於某種原因正在退出。當然,這可能是一些簡單且預期的事情,例如網路問題、遠端端斷開連接等。(OpenVPN 可以配置為在 VPN 出現故障時退出。)您可以使用類似
systemctl list-units | grep openvpn
或可能的方式查看所有 OpenVPN 單元systemctl show --property ConsistsOf openvpn.service