Last active
September 23, 2015 08:58
-
-
Save ls0f/e6ae146c7e7ed0c2f3cf to your computer and use it in GitHub Desktop.
install vpn on ubuntu
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 | |
default_user="vpn" | |
default_password="123456" | |
read -p "Input VPN username:(default is ${default_user})" user | |
read -p "Input VPN password:(default is ${default_password})" password | |
if [ $user=="" ];then | |
user=$default_user | |
fi | |
if [ $password=="" ];then | |
password=$default_password | |
fi | |
apt-get install pptpd | |
echo "localip 192.168.0.1" >> /etc/pptpd.conf | |
echo "remoteip 192.168.0.100-110" >> /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 | |
echo "${user} * ${password} *" >> /etc/ppp/chap-secrets | |
echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf | |
sysctl -p | |
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE | |
/etc/init.d/pptpd restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment