Created
June 19, 2015 07:06
-
-
Save cbranch/6077304c6d74e61df7b0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
read -e -p "Type a username you will use to connect to the VPN: " VPN_USER | |
read -e -p "Type a password for that user in the VPN: " VPN_PASSWORD | |
# setup PPTP | |
apt-get install pptpd -y | |
echo "$VPN_USER pptpd $VPN_PASSWORD *" >>/etc/ppp/chap-secrets | |
echo "localip 10.0.0.1" >>/etc/pptpd.conf | |
echo "remoteip 10.0.0.100-200" >>/etc/pptpd.conf | |
echo "ms-dns 8.8.8.8" >>/etc/ppp/pptpd-options | |
echo "ms-dns 8.8.4.4" >>/etc/ppp/pptpd-options | |
service pptpd restart | |
# setup NAT | |
echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf | |
sysctl -p | |
iptables -t nat -A POSTROUTING -s 10.0.0.0/24 -o venet0 -j MASQUERADE | |
# install iptables-persistent | |
echo "iptables-persistent iptables-persistent/autosave_v4 boolean true" | debconf-set-selections | |
echo "iptables-persistent iptables-persistent/autosave_v6 boolean true" | debconf-set-selections | |
apt-get install iptables-persistent |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment