大网数据广告活动
服务器运维问答

OpenVPN HA Setup on AWS

· 52CE 我爱测

We are using Paid version of OpenVPN on AWS. Now we want to setup HA but we could not find any proper solution for OpenVPN HA on AWS. Tried OpenVPN document but it doesn't meet the requirement of HA on AWS. Can anyone share/sugge…

问题原文

原帖链接 · sanjayparmar · CC BY-SA 3.0

We are using Paid version of OpenVPN on AWS. Now we want to setup HA but we could not find any proper solution for OpenVPN HA on AWS. Tried OpenVPN document but it doesn't meet the requirement of HA on AWS. Can anyone share/suggest best solution for OpenVPN HA ON AWS

已采纳解答

原帖链接 · Luca Gibelli · CC BY-SA 3.0

Start two OpenVPN Access Server instances, assign an Elastic IP to each of them. Configure them for LDAP authentication, so that you don't need to create all accounts twice and keep them sync'ed across the two instances.

Open the admin interface on ip:443/admin and click LDAP -> Set LDAP:

https://openvpn.net/index.php/access-server/docs/admin-guides/190-how-to-authenticate-users-with-active-directory.html

You can deploy your own LDAP service or you can use:

https://aws.amazon.com/directoryservice

Now you have to decide how you want clients to connect to these instances.

The easiest way is to add to the client config both OpenVPN Access Servers:

remote-random
remote hostname-of-instance1
remote hostname-of-instance2

Alternatively you could create a round robin record in AWS Route53 with both IP addresses and have Route53 monitor the reachability of the nodes and remove the unreachable instance when needed:

https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/dns-failover.html

In this case you only need:

remote round-robin-record

in your OpenVPN clients config file.

Alternatively you could deploy an AWS ELB, choose the number of instances that you want in execution at any time and let the ELB spawn and retire instances as required, whenever they die or become unreachable.

In this case your OpenVPN clients would be connecting to the IP address/hostname of the ELB itself.

EDIT: When one of the OpenVPN servers goes down, your clients will get disconnected and most likely you want them to automatically reconnect to the surving OpenVPN server. You can achieve this by adding:

keepalive 10 120

to the OpenVPN config file. More info on: https://openvpn.net/index.php/open-source/documentation/manuals/65-openvpn-20x-manpage.html

With this setting, clients and servers will ping each other every 10 secs. If no traffic is seen by one party for longer than 120 secs, the tunnel is shutdown + restarted.

EDIT2:

If you don't want OpenVPN to prompt the user to re-enter his login/password everytime he reconnects, ask him to add this to his OpenVPN client config file:

auth-user-pass auth.txt

Then create a file called auth.txt in the same dir of the config file, with just two lines:

mylogin
mypassword

Make sure the file is adequately protected.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-04-18)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。