Last active
August 29, 2015 14:02
-
-
Save yulingtianxia/296b1b3b2edf5d762ae7 to your computer and use it in GitHub Desktop.
VPN pptp 脚本
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/sh | |
if [ `id -u` -ne 0 ] | |
then | |
echo "please run it by root" | |
exit 0 | |
fi | |
apt-get -y update | |
apt-get -y install pptpd || { | |
echo "could not install pptpd" | |
exit 1 | |
} | |
cat >/etc/ppp/options.pptpd <<END | |
name pptpd | |
refuse-pap | |
refuse-chap | |
refuse-mschap | |
require-mschap-v2 | |
require-mppe-128 | |
ms-dns 8.8.8.8 | |
ms-dns 8.8.4.4 | |
proxyarp | |
lock | |
nobsdcomp | |
novj | |
novjccomp | |
nologfd | |
END | |
cat >/etc/pptpd.conf <<END | |
option /etc/ppp/options.pptpd | |
logwtmp | |
localip 192.168.2.1 | |
remoteip 192.168.2.10-100 | |
END | |
cat >> /etc/sysctl.conf <<END | |
net.ipv4.ip_forward=1 | |
END | |
sysctl -p | |
iptables-save > /etc/iptables.down.rules | |
iptables -t nat -A POSTROUTING -s 192.168.2.0/24 -o eth0 -j MASQUERADE | |
iptables -I FORWARD -s 192.168.2.0/24 -p tcp --syn -i ppp+ -j TCPMSS --set-mss 1300 | |
iptables-save > /etc/iptables.up.rules | |
cat >>/etc/ppp/pptpd-options<<EOF | |
pre-up iptables-restore < /etc/iptables.up.rules | |
post-down iptables-restore < /etc/iptables.down.rules | |
EOF | |
cat >/etc/ppp/chap-secrets <<END | |
yulingtianxia pptpd 123456 * | |
802 pptpd 802 * | |
END | |
service pptpd restart | |
netstat -lntp | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment