Access VPC

In the Download Configuration dialog, choose the appliance that fits your environment. For this lab, we will use Strongswan:



vi /etc/sysctl.conf

net.ipv4.ip_forward = 1
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.all.send_redirects = 0

sysctl -p

sudo su
amazon-linux-extras install epel -y
yum install strongswan -y

ls -la /etc/strongswan/

vi /etc/strongswan/ipsec.conf

:%d to delete all existing content.conn Tunnel1
authby=secret
auto=start
left=%defaultroute
leftid=YOUR_ONPREM_PUBLIC_IP
right=AWS_VPN_TUNNEL1_IP
ike=aes128-sha1-modp1024
esp=aes128-sha1-modp1024
keyexchange=ike
ikelifetime=8h
keylife=1h
dpdaction=restart
dpddelay=10s
dpdtimeout=30s
leftsubnet=10.11.0.0/16
rightsubnet=10.10.0.0/16
type=tunnel
conn Tunnel2
authby=secret
auto=start
left=%defaultroute
leftid=YOUR_ONPREM_PUBLIC_IP
right=AWS_VPN_TUNNEL2_IP
ike=aes128-sha1-modp1024
esp=aes128-sha1-modp1024
keyexchange=ike
ikelifetime=8h
keylife=1h
dpdaction=restart
dpddelay=10s
dpdtimeout=30s
leftsubnet=10.11.0.0/16
rightsubnet=10.10.0.0/16
type=tunnel

vi /etc/strongswan/ipsec.secrets to create the file.:%d to delete all existing content.13.208.242.73 13.208.84.230 : PSK "g2XToPyWlZALYxaIRtEkmrMV1vbh_IYR"
13.208.242.73 13.208.68.96 : PSK "EGBSrQnCXxJ881JL_Q3V1rMM1DpbL5RY"

:wq! to save the configuration file.cat /etc/strongswan/ipsec.secrets to verify the contents of the configuration file.
Start strongSwan:
sudo systemctl enable strongswan
sudo systemctl start strongswan
sudo systemctl status strongswan

Check the connection status:
sudo swanctl --list-conns

sudo swanctl --list-sas

Note the in and out rows — these represent the data received and sent through the tunnel. Right now, it should be 0 bytes.
Checking the Tunnel Details of the VPN connections in the AWS Console, the status of both tunnels should now be Up.

Once configuration is complete, try pinging from the Customer Gateway server to the EC2 Private server. If the VPN configuration was successful, you should get a result like the one below.
ping <EC2 Private IP> -c5


ping <Customer Gateway IPV4> -c5


sudo swanctl --list-sas

We have now successfully deployed a Site-to-Site VPN with a Transit Gateway using the strongSwan vendor.