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

Setting up Open VPN client on Amazon EC2

· 52CE 我爱测

There are various pages that advise on setting up an Open VPN Server on Amazon EC2, but all I need is to setup a client (so any internet access is routed through the VPN rather than coming directly from AWS IPs). I can transfer t…

问题原文

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

There are various pages that advise on setting up an Open VPN Server on Amazon EC2, but all I need is to setup a client (so any internet access is routed through the VPN rather than coming directly from AWS IPs). I can transfer the .ovpn file to it and start it with

openvpn --config client.ovpn

But as soon as I do this I lose my ssh connection and therefore cant do anything with it. Googled extensively and found various suggestions that claim to bypass either certain ports or certain IP addresses. Either would be fine, i.e. I am happy to be restricted to certain IPs to connect via ssh when its running.

However, none of these seem to work in Amazons environment, e.g. see OpenVPN client on Amazon EC2. Its a new instance, so sits in VPC if this helps.

社区高分解答

原帖链接 · dusan · CC BY-SA 4.0

In my case I only needed to route a certain IP through the VPN connection, so I added those lines to the OpenVPN's configuration file:

route-nopull
route The.IP.To.Go 255.255.255.255

And then:

sudo openvpn --config vpnconfigfile.ovpn

Taken from https://serverfault.com/a/747828 and https://superuser.com/a/628488

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

资料来源与适用范围

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

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

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