AWS 实例上的 OpenVPN 中断连接

AWS 实例上的 OpenVPN 中断连接

概括:我想在 EC2 实例上设置 OpenVPN 服务器(Ubuntu 16.04)。重启后无法配置其接口。

细节

  • 图像安装良好,重新启动正常
  • apt update ; apt get openvpn正确引入 OpenVPN
  • 最小的测试设置共享密钥从命令行启动时有效(udp/1945正在监听)

现阶段一切都正常。

重新启动时,此机器的状态检查失败

在此处输入图片描述

服务器日志显示该机器无法提升其网络接口:

(...)

[    6.624548] cloud-init[519]: Cloud-init v. 0.7.7 running 'init-local' at Mon, 06 Jun 2016 13:36:41 +0000. Up 6.36 seconds.
OK Started Initial cloud-init job (pre-networking).
OK Reached target Network (Pre).
         Starting Raise network interfaces...
OK Started ifup for tun0.
OK Found device /sys/subsystem/net/devices/tun0.
* A start job is running for Raise network interfaces (7s / 5min 1s)

(...)

* A start job is running for Raise network interfaces (30s / 5min 1s)
* A start job is running for Raise network interfaces (30s / 5min 30s)
FAILED Failed to start Raise network interfaces.
See 'systemctl status networking.service' for details.
DEPEND Dependency failed for Initial cloud... job (metadata service crawler).
OK Reached target Network.
         Starting OpenVPN service...
         Starting OpenBSD Secure Shell server...
(...)

Ubuntu 16.04 LTS ip-172-31-16-245 ttyS0

ip-172-31-16-245 login: 

EC2 实例配置其接口的方式有什么特别之处?

硬件服务器上的相同设置运行没有问题,所以我认为这一定是 EC2 特有的。

答案1

OpenVPN ( ) 的 systemd 服务文件必须使用以下条目进行更新:/lib/systemd/system/[email protected]After=network.target network-online.target

[Unit]
Description=OpenVPN connection to %i
PartOf=openvpn.service
ReloadPropagatedFrom=openvpn.service
Before=systemd-user-sessions.service
After=network.target network-online.target # This is needed
Documentation=man:openvpn(8)
Documentation=https://community.openvpn.net/openvpn/wiki/Openvpn23ManPage
Documentation=https://community.openvpn.net/openvpn/wiki/HOWTO

所有功劳归于sc250024谁发了解决方案在 AWS 论坛上。

編輯:已提交错误与 Canonical 合作。目前尚无进展。

相关内容