-
-
Save jcppkkk/4166337 to your computer and use it in GitHub Desktop.
Automaticlly install pptpd on Ubuntu 12.04
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
# Authors: Alvin Ye | |
# Run by: curl -sL https://gist.github.com/1471830.txt | sudo bash | |
sudo apt-get install pptpd | |
sed -i 's/^logwtmp/#logwtmp/g' /etc/pptpd.conf | |
sed -i 's/^net.ipv4.ip_forward = 0/net.ipv4.ip_forward = 1/g' /etc/sysctl.conf | |
sysctl -p | |
echo "localip 192.168.240.1" >> /etc/pptpd.conf | |
echo "remoteip 192.168.240.2-100" >> /etc/pptpd.conf | |
echo "ms-dns 208.67.222.222" >> /etc/ppp/options | |
echo "ms-dns 8.8.8.8" >> /etc/ppp/options | |
pass=`openssl rand 8 -base64` | |
if [ "$1" != "" ] | |
then pass=$1 | |
fi | |
echo "vpn pptpd ${pass} *" >> /etc/ppp/chap-secrets | |
iptables -t nat -A POSTROUTING -s 192.168.240.0/24 -j SNAT --to-source `ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk 'NR==1 { print $1}'` | |
iptables -A FORWARD -p tcp --syn -s 192.168.240.0/24 -j TCPMSS --set-mss 1356 | |
sudo iptables-save | |
sudo /etc/init.d/iptables restart | |
sudo /etc/init.d/pptpd restart | |
echo -e "VPN service is installed, your VPN username is \033[1mvpn\033[0m, VPN password is \033[1m${pass}\033[1m" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment