Ubuntu 12.04 + PPTP VPN For OSX, Windows, iPad, and iPhone clients
For some time now I’ve been needing a VPN for multiple reasons including security, watching netflix (or hulu) while overseas, etc.
Amazon EC2 offers a free virtual machine ‘instance’ for new AWS members for a year, so I decided to go ahead and use this instance to host the VPN server. I prefer to use FreeBSD, but FreeBSD has some issues/difficulties running on EC2, so I ended up going with Ubuntu 12.04 LTS.
First we need to install pptpd.
sudo apt-get install pptpd
Now we need to uncomment the local and remote ip lines at the bottom of /etc/pptpd.conf
This is what mine now looks like after uncommenting 2 lines.
# (Recommended) localip 22.214.171.124 remoteip 192.168.0.234-238,192.168.0.245
In /etc/sysctl.conf we need to enable ip forwarding so i’ve uncommented the following line:
# Uncomment the next line to enable packet forwarding for IPv4 net.ipv4.ip_forward=1
Now in /etc/rc.local we need to enable IP Forwarding so I insert this line above the exit 0:
# PPTP IP Forwarding iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
Now edit /etc/ppp/chap-secrets and insert a user and password (in plain text):
# Secrets for authentication using CHAP # client server secret IP addresses spike pptpd password *
That’s all that should need to be done, now pptpd should be automatically starting with your ubuntu server, accepting incoming connections, and forwarding traffic to the internet.
I have tested this pptp VPN on Windows, Mac OS X, and iPad/iPhone and it functions on all.