Ubuntu PPTP

by chenxs
619 deployments · 238 still active · last rev. 2 years ago

PPTP VPN for sniper2046
http://dwz.cn/mylinode

Compatible with: Ubuntu 12.04 LTS, Ubuntu 14.04 LTS
						#!/bin/bash

apt-get update
apt-get -y upgrade
apt-get -y install pptpd

cat > /etc/pptpd.conf <<EOF
option /etc/ppp/pptpd-options
logwtmp
localip 192.168.0.1
remoteip 192.168.0.2-123
EOF

cat > /etc/ppp/pptpd-options <<EOF
name pptpd
refuse-pap
refuse-chap
require-mschap-v2
require-mppe-128
ms-dns 8.8.8.8
ms-dns 8.8.4.4
proxyarp
nodefaultroute
debug
logfile /var/log/pptpd.log
lock
nobsdcomp
EOF

echo "vpn pptpd vpn123 *" > /etc/ppp/chap-secrets

sed -i "s/net.ipv4.ip_forward=0/net.ipv4.ip_forward=1/g" /etc/sysctl.conf
sed -i "s/#net.ipv4.ip_forward/net.ipv4.ip_forward/g" /etc/sysctl.conf
sysctl -p

iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERADE
iptables -I FORWARD -p tcp --syn -i ppp+ -j TCPMSS --set-mss 1356

iptables-save > /etc/iptable-pptp

cat > /etc/network/if-up.d/enable-pptp-iptable <<EOF
#!/bin/sh
iptables-restore < /etc/iptable-pptp
EOF

/etc/init.d/pptpd restart

rm ~/StackScript