AWS实例上的OpenVPN会中断连接

简介 :我想在EC2实例( Ubuntu 16.04 )上设置一个OpenVPN服务器。 重启后无法configuration接口。

详情

  • 图像安装正常,重启很好
  • apt update ; apt get openvpn apt update ; apt get openvpn正确apt update ; apt get openvpn OpenVPN
  • 使用共享密钥的最小testing设置在从命令行启动时工作( udp/1945正在监听)

在这个阶段,一切都好。

当重新启动这台机器的状态检查失败

在这里输入图像说明

服务器日志显示机器无法boost其networking接口:

 (...) [ 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实例configuration其接口的具体方式是什么?

在硬件服务器上的相同的设置工作没有问题,所以我认为这必须是特定于EC2的东西。

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 

所有功劳都归功于在AWS论坛发布解决scheme的 sc250024 。

编辑:一个错误提交 Canonical。 目前没有进展。