Debian

Debian openvpn 客戶端 systemd 服務

  • February 3, 2021

剛剛在 Debian 9 上安裝了 openvpn,尋找在啟動時啟用客戶端的正確方法:

apt install openvpn

這不起作用:

打開配置文件時出錯:/etc/openvpn/myclient

:

nano /etc/openvpn/client/myclient.ovpn
systemctl status openvpn-client@myclient
systemctl start openvpn-client@myclient


giu 10 11:23:11 gigi openvpn[15284]: Options error: In [CMD-LINE]:1: Error opening configuration file: myclient.conf
giu 10 11:23:11 gigi openvpn[15284]: Use --help for more information.
giu 10 11:23:11 gigi systemd[1]: openvpn-client@myclient.service: Main process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd

具有配置文件名的 Insteda 將起作用:

nano /etc/openvpn/client/myclient.conf 
systemctl start openvpn-client@myclient

但是在conf名稱中帶有“-”它將失敗。

這將起作用:

nano /etc/openvpn/client/myclient.conf
systemctl status openvpn@myclient
systemctl enable openvpn@myclient

● openvpn@myclient.service - OpenVPN tunnel for myclient
  Loaded: loaded (/lib/systemd/system/openvpn-client@.service; enabled; vendor preset: enabled)
  Active: inactive (dead)

沒有找到任何關於它的文件,看看是否應該以一種或另一種方式工作。

哪種方式應該首選openvpn/client/conf或openvpn/conf?

使用“.conf”文件它正在工作:/etc/openvpn/client/myclient.conf。是文件夾路徑錯誤!

引用自:https://serverfault.com/questions/970787