Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Set up a VPN Server (PPTP) on AWS and use it anywhere

Set up a VPN Server (PPTP) on AWS

  1. Create a EC2 instance using Ubuntu 14.04.
  2. In Secure Group Inbound Rules, add a SSH Rule(TCP, Port 22, 0.0.0.0/0) and a Custom TCP Rule(TCP, Port 1723, 0.0.0.0/0).
  3. Optional: Associate a Elastic IP with the instance.
  4. SSH into the instance.
  5. sudo apt-get install pptpd.
  6. sudo vim /etc/pptpd.conf. Uncomment localip 192.168.0.1 and remoteip 192.168.0.234-238,192.168.0.245.
  7. sudo vim /etc/ppp/pptpd-options. Uncomment ms-dns and ms-wins. Change the IP to Google's DNS like this:
ms-dns 8.8.8.8
ms-dns 8.8.4.4

#...

ms-wins 8.8.8.8
ms-wins 8.8.4.4
  1. sudo vim /etc/ppp/chap-secrets. Add VPN users in this format <username> pptpd <passwd> *.
  2. sudo vim /etc/sysctl.conf. Uncomment net.ipv4.ip_forward=1.
  3. sudo /sbin/sysctl -p.
  4. sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE.
  5. sudo vim /etc/rc.local. Add iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE before exit 0.
  6. sudo /etc/init.d/pptpd restart.

OSX Usage

  1. Go to System Preferences > Network.
  2. Click the + button. Choose VPN as interface. PPTP as VPN Type. And enter a name you can understand. Click Create.
  3. Enter your instance's Public IP in Server Address.
  4. Enter your <username> in Account Name.
  5. Click Authentication Settings. Choose Password and enter your <password>.
  6. Click Advanced. Check Send all traffic over VPN connection. Click OK.
  7. Click Apply.
  8. Click Connect.
  9. You are good to go.

iOS Usage

  1. Go to Settings > General > VPN.
  2. Touch Add VPN Configuration....
  3. Choose PPTP.
  4. Enter any name in Description.
  5. Enter your instance's Public IP in Server.
  6. Enter your <username> in Account.
  7. Enter your <password> in Password.
  8. Turn on Send All Traffic.
  9. Save.
  10. Switch on the VPN connection.
  11. You are good to go.
@hubdotcom

This comment has been minimized.

Copy link

@hubdotcom hubdotcom commented Jun 22, 2017

Google's DNS is 8.8.8.8 and 8.8 .4.4
https://developers.google.com/speed/public-dns/

@Sjors

This comment has been minimized.

Copy link

@Sjors Sjors commented Feb 16, 2018

It seems iOs no longer supports PPTP.

@gexplozer

This comment has been minimized.

Copy link

@gexplozer gexplozer commented Mar 15, 2018

Thanks so much!

@lguru

This comment has been minimized.

Copy link

@lguru lguru commented Sep 14, 2020

can I use some other ports
or some other protocol e.g, UDP?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.