PPTP一键安装脚本

VPS有很多种玩法,在墙上打洞是最常见的玩法之一。打洞方法多种多样,其中以PPTP最为常见,也是配置起来最为简便的方式之一。
本脚本只需执行一次即可将PPTP服务安装完毕,然后在你的电脑里设置好VPN即可。当然了,要保证你的VPS是在外面的自由世界中,而且VPS是基于Xen或KVM的。

注意:本脚本仅适用于 CentOS 6

终端里运行以下命令(以root用户运行):

cd /root
wget --no-check-certificate https://raw.githubusercontent.com/teddysun/across/master/pptp.sh
chmod +x pptp.sh
./pptp.sh

整个安装过程一般不超过2分钟,甚至30秒搞定。脚本执行到最后会出现以下提示:

PPTP VPN service is installed.
ServerIP:your_server_IP
Username:vpn
Password:random password
Welcome to visit: http://teddysun.com/134.html

当然,这是预定义好的一个用户名(vpn)和密码(随机生成的6位字符串),要想增加用户怎么办呢?
很简单,用任一文本编辑器打开 /etc/ppp/chap-secrets,按照其中既有的用户格式添加即可。

VPN连接出现619错误的解决办法:
用文本编辑器打开/var/log/messages文件,找到这样的错误提示:
“GRE: read(fd=6,buffer=8059660,len=8196) from PTY failed: status = -1 error = Input/output error, usually caused by unexpected termination of pppd, check option syntax and pppd logs”
“CTRL: GRE read or PTY write failed (gre,pty)=(7,6)”
这说明是logwtmp这个配置选项出现问题,编辑/etc/pptpd.conf文件,注释掉logwtmp选项(前面加个#即可注释),重启pptpd服务。

已有 60 条评论

  1. getgit 说:
    Microsoft Edge 12.10240 Microsoft Edge 12.10240 Windows 10 x64 Edition Windows 10 x64 Edition

    请问下,能连上,但是不能上网是怎么回事?是NAT的原因么?防火墙是开着的

  2. as 说:
    Internet Explorer 11.0 Internet Explorer 11.0 Windows 10 x64 Edition Windows 10 x64 Edition

    centos7的话 需要修改什么呢

    • 秋水逸冰 说:
      Google Chrome 46.0.2490.71 Google Chrome 46.0.2490.71 Windows 7 x64 Edition Windows 7 x64 Edition

      不支持在 CentOS 7 下安装。

  3. Gavin 说:
    Google Chrome 39.0.2171.71 Google Chrome 39.0.2171.71 Windows 8.1 x64 Edition Windows 8.1 x64 Edition

    注释了还是报619,求解决办法

  4. empty 说:
    Google Chrome 45.0.2454.99 Google Chrome 45.0.2454.99 Windows 7 x64 Edition Windows 7 x64 Edition

    怎么卸载呢?

  5. Sean 说:
    Google Chrome 45.0.2454.85 Google Chrome 45.0.2454.85 Mac OS X 10.10.5 Mac OS X 10.10.5

    您好,我发现用您的脚本装不上,我们在安装之前把iptables规则清掉就可以了。命令行如下
    iptables -F
    iptables -X
    iptables -Z

  6. saya 说:
    Firefox 40.0 Firefox 40.0 Windows 10 x64 Edition Windows 10 x64 Edition

    为什么我装了IKEv2和PPTP会冲突?IKEv2和PPTP都能连接上,但是PPTP无外网访问权限,求解答,谢谢!

    • 秋水逸冰 说:
      Google Chrome 44.0.2403.157 Google Chrome 44.0.2403.157 Windows 7 x64 Edition Windows 7 x64 Edition

      检查 iptables 设置,是否有转发规则。

      • saya 说:
        Firefox 40.0 Firefox 40.0 Windows 10 x64 Edition Windows 10 x64 Edition

        谢谢,我去看一看

      • saya 说:
        Firefox 40.0 Firefox 40.0 Windows 10 x64 Edition Windows 10 x64 Edition

        我还是用PPTP吧,IKEv2经常连接上去后,等于没有翻,IP还是自己的那个,好像跟系统有关系

      • saya 说:
        Firefox 40.0 Firefox 40.0 Windows 10 x64 Edition Windows 10 x64 Edition

        你好,我想请问下,如何检查 iptables 设置

        • 秋水逸冰 说:
          Google Chrome 44.0.2403.157 Google Chrome 44.0.2403.157 Windows 7 x64 Edition Windows 7 x64 Edition

          检查文件 /etc/sysconfig/iptables 中的内容。

          • saya 说:
            Firefox 40.0 Firefox 40.0 Windows 10 x64 Edition Windows 10 x64 Edition

            好的,谢谢,我去折腾一下!

  7. shizhao 说:
    Google Chrome 44.0.2403.107 Google Chrome 44.0.2403.107 Windows 7 Windows 7

    好奇怪,服务器上安装成功。win 7下vpn登录成功,但同一个网络下,安卓手机不能登录

发表评论

*