Site-to-Site VPN Connection

 

For Site-to-site VPN Connection 

We required one AWS site and one Client site (On-premises or on AWS but in other regions).

AWS Site (Mumbai Region)

1.       Create VPC and put CIDR 10.1.0.0/16     - VPC > Create VPC >VPC Name (Ex: AWS_site_VPC_Mumbai)

2.       Create Subnet and put CIDR 10.1.0.0/24   - Subnet >Create Subnet > Subnet Name (Ex: AWS_site_subnet_Mumbai)

3.       Create Internet Gateways    - VPC > Internet Gateways >Name (Ex: AWS_Site_IGW_Mumbai)

4.       Attach Internet Gateways to VPC (Ex: vpc-01e23b4b87c5c2586 |AWS_Site_VPC_Mumbai)

5.       Create Route Table   - VPC > Route Table > Create Route Table > Tag Name and Select VPC(Ex: AWS_Site_RT_Mumbai)

6.       Define Internet Gateway Route in the Route table (Ex:0.0.0.0/0)

7.       Associate Subnet> subnet associations > Edit subnet associations >Save

8.       Create Virtual private gateways and attach them with VPC

9.       Create Customer gateways and put the Public IP of the Client EC2 Machine (Customer_Site_EC2_Tokyo 3.112.18.180)

Customer gateways > Create customer gateway (Ex: Customer_Site_CGW_Mumbai)

10.   Create a site-to-site VPN connection (Ex : VPN_Connection_Mumbai_to_Tokyo)

 

site-to-site VPN connection > VPN Connection > Create VPN connection

 

Select Virtual private gateway, Customer gateway, and Static IP prefixes (put Customer_Site_subnet_Tokyo  IP -10.2.0.0/16 through which Customer can Access AWS Site from clients site)

11.   Download configuration-when VPN connection available then Download configuration. Select Vendor Generic Type.(Ex: vpn-01163e6dc4d63c416)

12.   Enable Route Propagation in the route table of AWS_Site_RT_Mumbai. When we enable route propagation it suggests the route for the tunnel.

Client site (AWS Tokyo Region)

Here we create VPC for the customer's end (office/home)

13.   Create VPC and put CIDR 10.2.0.0/16     - VPC > Create VPC >VPC Name (Ex: Customer_Site_VPC_Tokyo)

14.   Create Subnet and put CIDR 10.2.0.0/24   - Subnet >Create Subnet > Subnet Name (Ex: Customer_Site_Subnet_Tokyo)

15.   Create Internet Gateways    - VPC > Internet Gateways >Name (Ex: Customer_Site_IGW_Tokyo)

16.   Attach Internet Gateways to VPC (Ex: vpc-05181a9e9d91a39e7 | Customer_Site_VPC_Tokyo)

17.   Create Route Table   - VPC > Route Table > Create Route Table > Tag Name and Select VPC(Ex: Customer_Site_RT_Tokyo)

18.   Define Internet Gateway Route in the Route table (Ex:0.0.0.0/0       vpc-05181a9e9d91a39e7 | Customer_Site_VPC_Tokyo)

19.   Associate Subnet> subnet associations > Edit subnet associations >Save

20.   Create EC2 Machine, Select VPC, Subnet and Enable public IP, Security group name-Customer_Site_SG_Tokyo , Inbound Security Group Rules -SSH, All TCP(for VPN), All ICMP -IPv4(for ping) (Ex: Customer_Site_EC2_Tokyo)

21.   Access EC2 Machine through ssh.

C:\Users\DELL\OneDrive\Desktop>ssh ec2-user@3.112.18.180 -i Tokyo_Key.pem

22.   Install  openswan software

 

LOGIN AS-ec2-user

1.     Commands for Installation of Openswan

i.                Change to root user:

$ sudo su

ii.                   Install openswan:

$ yum install openswan -y

iii.                 In /etc/ipsec.conf uncomment following line if not already

uncommented:

 include /etc/ipsec.d/*.conf

iv.                 Update /etc/sysctl.conf to have following

net.ipv4.ip_forward = 1

net.ipv4.conf.all.accept_redirects = 0

net.ipv4.conf.all.send_redirects = 0

v.                   Restart network service:

$ service network restart

2.     Command for /etc/ipsec.d/aws-vpn.conf

conn Tunnel1

authby=secret

auto=start

left=%defaultroute

leftid=Customer end Gateway VPN public IP

right=AWS Virtual private gateway ID- public IP

type=tunnel

ikelifetime=8h

keylife=1h

phase2alg=aes128-sha1;modp1024

ike=aes128-sha1;modp1024

keyingtries=%forever

keyexchange=ike

leftsubnet=Customer end VPN CIDR

leftsubnet=Customer end VPN CIDR

dpddelay=10

dpdtimeout=30

dpdaction=restart_by_peer

 

3.     Contents for /etc/ipsec.d/aws-vpn.secrets

customer_public_ip aws_vgw_public_ip: PSK "shared secret"

4.     Commands to enable/start ipsec service

$ chkconfig ipsec on

$ service ipsec start

$ service ipsec status


***************Happy Learning*******************

Comments

Popular posts from this blog