第一个脚本适合RedHat/CentOS

#!/bin/sh
echo -e "\033[1;035m \n"
echo "#########################################################"
echo "                 WelCome to Www.90sec.org                "
echo "                     Linux install pptpd                 "
echo "                        By:Mr,PriNce                     "
echo "#########################################################"
if [ $(id -u) != "0" ];then
echo sorry,!root....
exit 1
fi
host=`hostname -i`
name=`hostname`
echo "                                 $name         "
echo "                                 $host         "
bit=`uname -a|grep "x86_64"`
if [ "$bit" = "" ];then
echo "32bit"
wget http://poptop.sourceforge.net/yum/stable/rhel5/i386/dkms-2.0.17.5-1.noarch.rpm
wget http://poptop.sourceforge.net/yum/stable/rhel5/i386/pptpd-1.3.4-2.rhel5.i386.rpm
rpm -ivh dkms-2.0.17.5-1.noarch.rpm --force --nodeps
rpm -ivh pptpd-1.3.4-2.rhel5.i386.rpm --force --nodeps
rm -rf pptpd-1.3.4-2.rhel5.i386.rpm
rm -rf dkms-2.0.17.5-1.noarch.rpm
cat >>/etc/pptpd.conf<<EOF
option /etc/ppp/options.pptpd
logwtmp
localip 192.168.1.12
remoteip 192.168.1.13-238
EOF
cat >>/etc/ppp/options.pptpd<<EOF
name pptpd
refuse-pap
refuse-chap
refuse-mschap
require-mschap-v2
require-mppe-128
proxyarp
lock
nobsdcomp
novj
novjccomp
nologfd
ms-dns 8.8.8.8
ms-dns 4.4.4.4
EOF
cat >>/etc/ppp/chap-secrets<<EOF
vpn         pptpd    vpn365     *
EOF
sed -i "s/net.ipv4.ip_forward = 0/net.ipv4.ip_forward = 1/g" grep "net.ipv4.ip_forward = 0" /etc/sysctl.conf
sysctl -p
iptables -t nat -A POSTROUTING -s 192.168.33.0/24 -j SNAT --to-source $host
iptables -t nat -A POSTROUTING -s 192.168.33.0/24 -o eth0 -j MASQUERADE
/etc/init.d/iptables save
/etc/init.d/iptables restart
/etc/init.d/pptpd restart
/etc/init.d/pptpd restart
chkconfig pptpd on
chkconfig iptables on
else
echo "64bit"
wget http://poptop.sourceforge.net/yum/stable/rhel5/x86_64/dkms-2.0.17.5-1.noarch.rpm
wget http://poptop.sourceforge.net/yum/stable/rhel5/x86_64/pptpd-1.3.4-2.rhel5.x86_64.rpm
rpm -ivh dkms-2.0.17.5-1.noarch.rpm --force --nodeps
rpm -ivh pptpd-1.3.4-2.rhel5.x86_64.rpm --force --nodeps
rm -rf dkms-2.0.17.5-1.noarch.rpm
rm -rf pptpd-1.3.4-2.rhel5.x86_64.rpm
cat >>/etc/pptpd.conf<<EOF
option /etc/ppp/options.pptpd
logwtmp
localip 192.168.1.12
remoteip 192.168.1.13-238
EOF
cat >>/etc/ppp/options.pptpd<<EOF
name pptpd
refuse-pap
refuse-chap
refuse-mschap
require-mschap-v2
require-mppe-128
proxyarp
lock
nobsdcomp
novj
novjccomp
nologfd
ms-dns 8.8.8.8
ms-dns 4.4.4.4
EOF
cat >>/etc/ppp/chap-secrets<<EOF
vpn         pptpd    liang     *
EOF
sed -i "s/net.ipv4.ip_forward = 0/net.ipv4.ip_forward = 1/g" grep "net.ipv4.ip_forward = 0" /etc/sysctl.conf
sysctl -p
iptables -t nat -A POSTROUTING -s 192.168.33.0/24 -j SNAT --to-source $host
iptables -t nat -A POSTROUTING -s 192.168.33.0/24 -o eth0 -j MASQUERADE
/etc/init.d/iptables save
/etc/init.d/iptables restart
/etc/init.d/pptpd restart
/etc/init.d/pptpd restart
chkconfig pptpd on
chkconfig iptables on            
echo "Thank you for using"
echo  "                                 $name         "
echo "                                  $host         "
fi

第二个适合ubuntu

#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
export PATH

clear
CUR_DIR=$(pwd)

if [ $(id -u) != "0" ]; then
printf "Error: You must be root to run this script!"
exit 1
fi

echo "#############################################################"
echo "# PPTP VPN Auto Install"
echo "# Env: Debian/Ubuntu"
echo "# Created by WangYan on 2011.05.20"
echo "# Author Url: http://wangyan.org"
echo "# Version: 1.0"
echo "#############################################################"
echo ""

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

cat >>/etc/pptpd.conf<<EOF
localip 10.10.10.1
remoteip 10.10.10.2-254
EOF

cp /etc/ppp/pptpd-options /etc/ppp/pptpd-options.old

cat >/etc/ppp/pptpd-options<<EOF
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
debug
dump
lock
nobsdcomp
novj
novjccomp
logfile /var/log/pptpd.log
EOF

cat >>/etc/ppp/chap-secrets<<EOF
test * test *
EOF
a
sed -i 's/#net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/g' /etc/sysctl.conf
sysctl -p

iptables-save > /etc/iptables.down.rules

iptables -t nat -A POSTROUTING -s 10.0.0.0/8 -j MASQUERADE
#iptables -I FORWARD -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

/etc/init.d/pptpd restart

脚本网上收集:Www.90sec.org&http://wangyan.org