Skip to content

Instantly share code, notes, and snippets.

@ls0f
Last active September 23, 2015 08:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ls0f/e6ae146c7e7ed0c2f3cf to your computer and use it in GitHub Desktop.
Save ls0f/e6ae146c7e7ed0c2f3cf to your computer and use it in GitHub Desktop.
install vpn on ubuntu
#!/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