CentOS 7-无法启动OpenVPN访问服务器


1

我一直在尝试在CentOS 7 VPS上安装OpenVPN访问服务器。但是,我遇到了许多问题。

最初,我遵循此DigitalOcean指南,但是在使用该指南遇到问题之后,后来我发现我打算安装Access Server。我找到了 CentOS 6.5的DigitalOcean指南,并将其调整为适用于CentOS 7。

我开始怀疑,是否遵循这两个不同指南的说明是造成我问题的原因。我可以通过命令行启动该服务,但不能通过Web界面启动它。

$ sudo systemctl status openvpn@server.service
openvpn@server.service - OpenVPN Robust And Highly Flexible Tunneling Application On server
   Loaded: loaded (/usr/lib/systemd/system/openvpn@.service; enabled)
   Active: active (running) since Thu 2015-03-05 08:12:53 EST; 3s ago
  Process: 1738 ExecStart=/usr/sbin/openvpn --daemon --writepid /var/run/openvpn/%i.pid --cd /etc/openvpn/ --config %i.conf (code=exited, status=0/SUCCESS)
 Main PID: 1745 (openvpn)
   CGroup: /system.slice/system-openvpn.slice/openvpn@server.service
           └─1745 /usr/sbin/openvpn --daemon --writepid /var/run/openvpn/server.pid --cd /etc/openvpn/ --config server.conf

Mar 05 08:12:53 arguru systemd[1]: Failed to read PID from file /var/run/openvpn/server.pid: Invalid argument
Mar 05 08:12:53 arguru openvpn[1745]: GID set to nobody
Mar 05 08:12:53 arguru openvpn[1745]: UID set to nobody
Mar 05 08:12:53 arguru openvpn[1745]: UDPv4 link local (bound): [undef]
Mar 05 08:12:53 arguru openvpn[1745]: UDPv4 link remote: [undef]
Mar 05 08:12:53 arguru openvpn[1745]: MULTI: multi_init called, r=256 v=256
Mar 05 08:12:53 arguru openvpn[1745]: IFCONFIG POOL: base=10.8.0.4 size=62, ipv6=0
Mar 05 08:12:53 arguru openvpn[1745]: IFCONFIG POOL LIST
Mar 05 08:12:53 arguru openvpn[1745]: Initialization Sequence Completed
Mar 05 08:12:53 arguru systemd[1]: Started OpenVPN Robust And Highly Flexible Tunneling Application On server.

但是,从Web面板,我收到此错误。 我的OpenVPN Web界面

我曾尝试搜索与此有关的多个不同资源,有人说问题是Web界面没有以root身份启动VPN,这就是为什么ifconfig错误发生的原因,而关于绑定失败的第二个错误仅在我启动OpenVPN时发生通过命令行。

我意识到我可能会在设置时出错,但是我想知道如何立即解决此问题而无需重新安装整个操作系统(此VPS供我自己学习和实验)。任何帮助表示赞赏!

Answers:


1

使用此软件包在Amazon Linux 2016.03上运行,以便在rpm install成功后使服务器运行,我需要:

sudo ln -s /sbin/ifconfig /usr/sbin/ifconfig

之所以openvpnas无法执行ifconfig,是因为它试图运行/usr/sbin/ifconfig。符号链接已修复它。


2

对于消息“地址已在使用中”,我认为这是因为https也在TCP端口443上进行侦听。


感谢您的回答,Luc!昨天我实际上发现问题是两件事。(1)我运行了OpenVPN的两种实现,一种是命令行版本,另一种是访问面板。(2)我没有net-tools安装,因为我正在运行CentOS的简约安装,因此问题ifconfig就出在这里。当我不在手机上时,我会尽快发布更新的答案!
贾斯汀·弗洛里

一旦我安装net-tools并删除了第二版OpenVPN,我的问题就立即得到解决,并且VPN现在正在运行。
贾斯汀·弗洛里

1

我已经解决了这个问题,我只是这样解决:

[root@linux1 openvpn]# vim server.conf
## Notify the client that when the server restarts so it
## can automatically reconnect.
;explicit-exit-notify 1

[root@linux1 openvpn]# systemctl restart openvpn@server

[root@linux1 openvpn]# systemctl status openvpn@server
● openvpn@server.service - OpenVPN Robust And Highly Flexible Tunneling Application On server
   Loaded: loaded (/usr/lib/systemd/system/openvpn@.service; disabled; vendor preset: disabled)
   Active: active (running) since Sun 2017-02-05 20:33:57 ICT; 13s ago
  Process: 11837 ExecStart=/usr/sbin/openvpn --daemon --writepid /var/run/openvpn/%i.pid --cd /etc/openvpn/ --config %i.conf (code=exited, status=0/SUCCESS)
 Main PID: 11838 (openvpn)
   CGroup: /system.slice/system-openvpn.slice/openvpn@server.service
           └─11838 /usr/sbin/openvpn --daemon --writepid /var/run/openvpn/ser...

Feb 05 20:33:57 linux1 openvpn[11838]: /usr/sbin/ip link set dev tun0 up mt...00
Feb 05 20:33:57 linux1 systemd[1]: Started OpenVPN Robust And Highly Flexib...r.
Feb 05 20:33:57 linux1 openvpn[11838]: /usr/sbin/ip addr add dev tun0 local....2
Feb 05 20:33:57 linux1 openvpn[11838]: /usr/sbin/ip route add 10.8.0.0/24 v....2
Feb 05 20:33:57 linux1 openvpn[11838]: UDPv4 link local (bound): [undef]
Feb 05 20:33:57 linux1 openvpn[11838]: UDPv4 link remote: [undef]
Feb 05 20:33:57 linux1 openvpn[11838]: MULTI: multi_init called, r=256 v=256
Feb 05 20:33:57 linux1 openvpn[11838]: IFCONFIG POOL: base=10.8.0.4 size=62...=0
Feb 05 20:33:57 linux1 openvpn[11838]: IFCONFIG POOL LIST
Feb 05 20:33:57 linux1 openvpn[11838]: Initialization Sequence Completed
Hint: Some lines were ellipsized, use -l to show in full.

我在#server.conf(; explicit-exit-notify 1)中禁用了此链接
user214638'2
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.