Debian openvpn 客户端 systemd 服务

Debian openvpn 客户端 systemd 服务

刚刚在 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]: [email protected]: 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

但如果会议名称中包含“-”,则会失败。

这将起作用:

nano /etc/openvpn/client/myclient.conf
systemctl status openvpn@myclient
systemctl enable openvpn@myclient
[email protected] - OpenVPN tunnel for myclient
   Loaded: loaded (/lib/systemd/system/[email protected]; enabled; vendor preset: enabled)
   Active: inactive (dead)

没有找到有关它的任何文档来查看是否应该以某种方式工作。

应该优先选择 openvpn/client/conf 还是 openvpn/conf 方式?

答案1

使用“.conf”文件可以正常工作:/etc/openvpn/client/myclient.conf。文件夹路径错误!

相关内容