支持VPN的美国VPS主机

    |     2016年2月23日   |   学习偶记   |     评论已关闭   |    4660

因为工作关系,租用过不少IDC的VPS主机,很多主机的pptp服务开启需要发送ticket,对于我们这种英文水平差的人,搞定这个Ticket需要很大的勇气。

前两天租用LETBOX的主机,惊奇的发现在主机信息栏下,有TUN/TAP 和 PPTP的开关。因为vps不贵,5G内存带20G共享DDos防御的VPS每月才15美元,连100元都不到,所以就租下来测试一番。

以下是服务器配置信息:

01

服务器安装好以后,就开装pptp了。

先在根目录下vi pptpd.sh,把执行脚本搞进去。

然后chmod +x pptpd.sh ,给脚本执行权限

然后./pptpd.sh执行脚本

vi /etc/ppp/chapsecrets 编辑添加vpn用户(刚才自动生成的vpn密码也在里面,可以改为自己熟悉的密码)

 

修改完密码后,即可快乐的使用vpn了。

 

附:pptp.sh 执行脚本

[sourcecode language=”plain”]

#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
#===================================================================
# SYSTEM REQUIRED: CentOS 6.x (32bit/64bit)
# DESCRIPTION: Install pptpd VPN
#===================================================================
cur_dir=pwd
clear
echo "#############################################################"
echo "# One-hit Install Script for PPTP VPN"
echo "# Distribution: CentOS 6.x(32bit/64bit)"
echo "# Intro: http://www.huangjiexing.com/398.html"
echo ""
echo "# Author: Hoshi <[email protected]>"
echo ""
echo "#############################################################"
echo ""
# Remove existing pptpd & ppp
yum remove -y pptpd ppp
iptables –flush POSTROUTING –table nat
iptables –flush FORWARD
rm -f /etc/pptpd.conf
rm -f /etc/ppp
arch=uname -m
# Download pptpd
if [ -s pptpd-1.3.4-2.el6.$arch.rpm ]; then
echo "pptpd-1.3.4-2.el6.$arch.rpm [found]"
else
echo "pptpd-1.3.4-2.el6.$arch.rpm not found!!!download now……"
if ! wget http://lamp.teddysun.com/files/pptpd-1.3.4-2.el6.$arch.rpm;then
echo "Failed to download pptpd-1.3.4-2.el6.$arch.rpm,please download it to $cur_dir directory manually and rerun the install script."
exit 1
fi
fi
# Install some necessary tools
yum -y install net-tools make libpcap iptables gcc-c++ logrotate tar cpio perl pam tcp_wrappers dkms ppp
rpm -ivh pptpd-1.3.4-2.el6.$arch.rpm

rm -f /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 192.168.8.1" >> /etc/pptpd.conf
echo "remoteip 192.168.8.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 "vpn pptpd ${pass} *" >> /etc/ppp/chap-secrets

iptables -t nat -A POSTROUTING -s 192.168.8.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 192.168.8.0/24 -j TCPMSS –set-mss 1356
service iptables save
chkconfig –add pptpd
chkconfig pptpd on
service iptables restart
service pptpd start

echo ""
echo "VPN service installed successfully, your VPN username is vpn, VPN password is ${pass}"
echo ""

exit 0

[/sourcecode]

噢!评论已关闭。