Project

General

Profile

Setting Up a VPN into Amazon's Public Cloud VPC » History » Version 2

Version 1 (Yaron Sheffer, 26.12.2011 10:55) → Version 2/29 (Yaron Sheffer, 26.12.2011 22:00)

h1. Setting Up a VPN into Amazon's Public Cloud VPC

The AWS VPC (Virtual Private Cloud) is somewhat inconvenient for developers. The standard way to access it is through an IPsec "hardware VPN". In practice this means having to deal with BGP, in addition to IPsec. This howto simplifies things by using StrongSwan to access the VPC instances. Neither hardware nor BGP are required.

h2. Scenario

We assume a single VPC subnet with Internet access (i.e., located behind an Internet Gateway). We have a small number of clients accessing the VPC remotely, from Linux machines. I believe the solution can be tweaked to allow for larger deployments.

h2. Solution Overview

We create a new, dedicated instance serving as a VPN gateway for the whole VPC. The solution uses tunnel-mode IPsec with IKEv2 and a virtual IP pool. StrongSwan is deployed on both client and gateway.

h2. Solution Steps

# Create a new VPC instance (the minimal instance type in VPC is Small). We have used a standard Ubuntu Oneiric image, ami-a562a9cc. You can use an existing instance but that would be much less secure. Note that the VPN Gateway instance can be stopped when not in use, and later restarted.
# Disable source/destination check on the instance.
# Assign an Elastic IP for the instance. This will be the gateway's address.
# Install StrongSwan on the gateway (and on your client, too). We have used the version available in the repository, 4.5.2.
# Define the gateway's security group(s) to allow incoming TCP/22, UDP/500 and UDP/4500.
* Once the gateway is fully set up, you will be able to disable TCP/22 in the security group and tunnel SSH through IPsec instead of directly. You simply SSH into the gateway's private IP address.
# Define a subnet for the virtual IP pool. It doesn't need to be inside the VPC. In our example the VPC encompasses 10.10.0.0/16, and the virtual IP pool will be drawn from 10.100.0.0/16.
# Allow any incoming traffic from this subnet into all VPC instances. For example, by adding an "all traffic" rule to the "default" security group of your VPC.



h2. Configuration Files