既然有了自己vps不架设一个vps简直是太浪费了。 写了个脚本自己安装,纯傻瓜操作一键搞定。 环境centos6 64

[root@codewalker ~]# cat ./auto.install.vpn.sh
yum remove -y pptpd ppp
iptables –flush POSTROUTING –table nat
iptables –flush FORWARD
rm -rf /etc/pptpd.conf
rm -rf /etc/ppp

rpm -Uvh http://poptop.sourceforge.net/yum/stable/rhel6/pptp-release-current.noarch.rpm
yum -y install policycoreutils make libpcap iptables gcc-c++ logrotate tar cpio perl pam tcp_wrappers kernel_ppp_mppe

yum -y install ppp pptpd

rm -rf /dev/ppp
mknod /dev/ppp c 108 0

#echo 1 > /proc/sys/net/ipv4/ip_forward
echo “mknod /dev/ppp c 108 0” >> /etc/rc.local

#echo “echo 1 > /proc/sys/net/ipv4/ip_forward” >> /etc/rc.local
echo “localip 10.0.0.1” >> /etc/pptpd.conf
echo “remoteip 10.0.0.2-254” >> /etc/pptpd.conf
echo “ms-dns 8.8.8.8” >> /etc/ppp/options.pptpd
echo “ms-dns 8.8.4.4” >> /etc/ppp/options.pptpd

pass=`openssl rand 6 -base64`
if [ “$1” != “” ]
then pass=$1
fi

echo “username pptpd hereisyourpassword *” >> /etc/ppp/chap-secrets

#update @20150311 上面那句需要解释一下

#格式为:

#client server secret IP addresses

#需要增加用户的话直接修改这个文件/etc/ppp/chap-secrets后重启pptpd即可.

iptables -t nat -A POSTROUTING -s 10.0.0.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 10.0.0.0/24 -j TCPMSS –set-mss 1356
service iptables save

chkconfig iptables on
chkconfig pptpd on
service iptables start
service pptpd start
cat /etc/ppp/chap-secrets

打完收工