Skip to content

Instantly share code, notes, and snippets.

@bingdian
Forked from HenryYang/pp2t_vpn.sh
Created April 23, 2017 13:23
Show Gist options
  • Save bingdian/5e2d4a5e5f11849270ed4673097e2d57 to your computer and use it in GitHub Desktop.
Save bingdian/5e2d4a5e5f11849270ed4673097e2d57 to your computer and use it in GitHub Desktop.
Easy Install PP2P VPN
#!/bin/bash
apt-get update
apt-get install -y pptpd
echo "localip 192.168.0.1" >> /etc/pptpd.conf
echo "remoteip 192.168.0.128-255" >> /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 -n "Enter User Name:"
read uname
echo -n "Enter Password:"
read upwd
echo "$uname pptpd $upwd 192.168.0.135" >> /etc/ppp/chap-secrets
/etc/init.d/pptpd restart
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERADE
apt-get install -y iptables-persistent
iptables-save > /etc/iptables-rules
pre-up iptables-restore < /etc/iptables-rules
echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf
sysctl -p
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment