用户工具

站点工具


开发:linux:openvpn

#安装 [一站式安装教程,完全适配 DigitaOcean VPS](https://www.digitalocean.com/community/tutorials/how-to-setup-and-configure-an-openvpn-server-on-centos-7) #客户端认证 因为CentOS 7 默认不支持MD5认证,会导致之前由MD5签发的证书会认证失败,解决方案有两种。 ###命令行运行解决方案

export NSS_HASH_ALG_SUPPORT=+MD5
export OPENSSL_ENABLE_MD5_VERIFY=1
openvpn --config service.conf

###服务运行解决方案 修改

/usr/lib/systemd/system/openvpn@.service

在Service中增加一行

Environment="OPENSSL_ENABLE_MD5_VERIFY=1 NSS_HASH_ALG_SUPPORT=+MD5"

将配置文件复制到

/etc/openvpn

并将配置文件修改为

service.conf

运行

systemctl enable openvpn@service.service
systemctl daemon-reload
systemctl restart openvpn@service.service

OpenVPN就能够作为一个服务启动 #客户端启动多个实例 打开系统服务所在路径

cd /etc/systemd/system/multi-user.target.wants/
ll

找到安装OpenVPN默认生成的一个链接文件

openvpn@service.service -> /usr/lib/systemd/system/openvpn@.service

查看openvpn@.service代码可以发现命名规则

ExecStart=/usr/sbin/openvpn --daemon --writepid /var/run/openvpn/%i.pid --cd /etc/openvpn/ --config %i.conf

这里`@service`就是参数。因此我们可以复制一个新的连接文件

ln -s /usr/lib/systemd/system/openvpn@.service openvpn@danding.service

并且在`/etc/openvpn/`中配置`danding.conf`。

然后启动这个服务

systemctl enable openvpn@danding.service
systemctl daemon-reload
systemctl restart openvpn@service.service

完成安装。

开发/linux/openvpn.txt · 最后更改: 2015-08-26 16:55 由 danding

粤ICP备16007019号-3