apt-get update
Install pptpd
sudo apt-get install pptpd
Open config file
sudo vi /etc/pptpd.conf # open config
Add these two lines at the bottom of file
localip 192.168.9.1
remoteip 192.168.9.11-30
Also uncomment this line!
# logwtmp
Open /etc/ppp/options.pptpd
sudo vi /etc/ppp/options.pptpd
Add this line to the top
ms-dns 8.8.8.8 ms-dns 8.8.4.4
Open /etc/ppp/chap-secrets
sudo vi /etc/ppp/chap-secrets
Add this line to the top
<username> pptpd <passwd> *
Open /etc/sysctl.conf
sudo vi /etc/sysctl.conf
Uncomment this line.
net.ipv4.ip_forward=1
Run this command to reload config
sudo /sbin/sysctl -p
Start iptables
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
For reboot
sudo vi /etc/rc.local
Add this line before exit 0
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
Restart pptpd
sudo /etc/init.d/pptpd restart
Remember to open port 1723 on EC2 instance.