• PPTP是什么?

PPTP是“Point-to-Point Tunneling Protocol”的缩写,一种快速的建立私有虚拟网络的技术-Virtual Private Networks (VPN) . 可以原生的支持许多操作系统,而不需要增加专门的客户端程序.这些优于OpenVPN。

  • 这个脚本能干啥?

这个脚本能在几分钟内安装PPTP/PoPToP到你的OpenVZ VPS. 端口转发,签名及服务器端设置这些都会自动帮你完成,你需要的只是设定使用者账户.

  • 如果我不想使用自动安装呢?

你如果不怕麻烦可以去这个地址查看,它有手动安装的过程介绍: http://www.putdispenserhere.com/pptp-vpn-setup-guide-for-a-debian-openvz-vps/

  • 开始吧,那我该怎么做呢?

1.首先要验证你VPS上的PPP模块是否正常配置,输入以下命令查询:

cat /dev/ppp

如果返回下面结果,说明PPP模块配置正确:

cat: /dev/ppp: No such device or address

否则,你需要去你的SolusVM打开它 (或者关闭再重新打开一次试试),还不行就去联系你的主机商吧.
728da9773912b31b40d5ef378418367adab4e177.jpg
2.执行下面代码:

wget https://raw.github.com/cwaffles/ezpptp/master/ezpptp.sh
chmod +x ezpptp.sh && ./ezpptp.sh

3.去你的手机或电脑设置VPN链接,享受吧

How can I contribute?
I’ve set up a Github repository here that you can fork and submit patches back to.

Script Source:

#!/bin/bash
# Interactive PoPToP install script for an OpenVZ VPS
# Tested on Debian 5, 6, and Ubuntu 11.04
# April 2, 2013 v1.11
# Author: Commander Waffles
# http://www.putdispenserhere.com/pptp-debian-ubuntu-openvz-setup-script/

echo "######################################################"
echo "Interactive PoPToP Install Script for an OpenVZ VPS"
echo
echo "Make sure to contact your provider and have them enable"
echo "IPtables and ppp modules prior to setting up PoPToP."
echo "PPP can also be enabled from SolusVM."
echo
echo "You need to set up the server before creating more users."
echo "A separate user is required per connection or machine."
echo "######################################################"
echo
echo
echo "######################################################"
echo "Select on option:"
echo "1) Set up new PoPToP server AND create one user"
echo "2) Create additional users"
echo "######################################################"
read x
if test $x -eq 1; then
    echo "Enter username that you want to create (eg. client1 or john):"
    read u
    echo "Specify password that you want the server to use:"
    read p

# get the VPS IP
ip=`ifconfig venet0:0 | grep 'inet addr' | awk {'print $2'} | sed s/.*://`

echo
echo "######################################################"
echo "Downloading and Installing PoPToP"
echo "######################################################"
apt-get update
apt-get -y install pptpd

echo
echo "######################################################"
echo "Creating Server Config"
echo "######################################################"
cat > /etc/ppp/pptpd-options <<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
nodefaultroute
lock
nobsdcomp
END

# setting up pptpd.conf
echo "option /etc/ppp/pptpd-options" > /etc/pptpd.conf
echo "logwtmp" >> /etc/pptpd.conf
echo "localip $ip" >> /etc/pptpd.conf
echo "remoteip 10.1.0.1-100" >> /etc/pptpd.conf

# adding new user
echo "$u    *   $p  *" >> /etc/ppp/chap-secrets

echo
echo "######################################################"
echo "Forwarding IPv4 and Enabling it on boot"
echo "######################################################"
cat >> /etc/sysctl.conf <<END
net.ipv4.ip_forward=1
END
sysctl -p

echo
echo "######################################################"
echo "Updating IPtables Routing and Enabling it on boot"
echo "######################################################"
iptables -t nat -A POSTROUTING -j SNAT --to $ip
# saves iptables routing rules and enables them on-boot
iptables-save > /etc/iptables.conf

cat > /etc/network/if-pre-up.d/iptables <<END
#!/bin/sh
iptables-restore < /etc/iptables.conf
END

chmod +x /etc/network/if-pre-up.d/iptables
cat >> /etc/ppp/ip-up <<END
ifconfig ppp0 mtu 1400
END

echo
echo "######################################################"
echo "Restarting PoPToP"
echo "######################################################"
sleep 5
/etc/init.d/pptpd restart

echo
echo "######################################################"
echo "Server setup complete!"
echo "Connect to your VPS at $ip with these credentials:"
echo "Username:$u ##### Password: $p"
echo "######################################################"

# runs this if option 2 is selected
elif test $x -eq 2; then
    echo "Enter username that you want to create (eg. client1 or john):"
    read u
    echo "Specify password that you want the server to use:"
    read p

# get the VPS IP
ip=`ifconfig venet0:0 | grep 'inet addr' | awk {'print $2'} | sed s/.*://`

# adding new user
echo "$u    *   $p  *" >> /etc/ppp/chap-secrets

echo
echo "######################################################"
echo "Addtional user added!"
echo "Connect to your VPS at $ip with these credentials:"
echo "Username:$u ##### Password: $p"
echo "######################################################"

else
echo "Invalid selection, quitting."
exit
fi

This script is built on Denis’s OpenVPN script modified for Debian support and PPTP installation.
翻译自: http://bluemodule.com/software/openvpn-install-script-for-openvz-vps/