人生就是由众多的细节组成的
正因为是个细节,所以常被人所淡忘

v-p-n安装指南

OpenVZ架构需要检查相关模块(TUN/TAP/PPP)是否开启, 如果没有开启相关模块不能上网代理。

cat /dev/ppp
cat: /dev/ppp: No such device or address
cat /dev/net/tun
cat: /dev/net/tun: File descriptor in bad state

TUN模块已经启用
PPP模块已经启用

添加或删除VPN帐号:

/etc/ppp/chap-secrets

一键安装

wget https://dl.dropbox.com/sh/44oorvdsjvz0mzn/NNL_fB9K7L/centos6_pptpd.sh
chmod +x centos6_pptpd.sh
./centos6_pptpd.sh
#!/bin/bash
 clear
 echo ""
 echo -e "\033[44;37m ###################################### \033[0m"
 echo -e "\033[44;37m #   PPTPD Installer for CentOS 6.x   # \033[0m"
 echo -e "\033[44;37m #                                    # \033[0m"
 echo -e "\033[44;37m #    The original from DiaHosting    # \033[0m"
 echo -e "\033[44;37m #                                    # \033[0m"
 echo -e "\033[44;37m # Modify by Jetso / Date: 2012-12-15 # \033[0m"
 echo -e "\033[44;37m #                                    # \033[0m"
 echo -e "\033[44;37m #   Weibo: http://t.qq.com/jetsor    # \033[0m"
 echo -e "\033[44;37m #                                    # \033[0m"
 echo -e "\033[44;37m #           Version: 1.0             # \033[0m"
 echo -e "\033[44;37m ###################################### \033[0m"
 echo ""

## Define ##
 get_char()
 {
 SAVEDSTTY=`stty -g`
 stty -echo
 stty cbreak
 dd if=/dev/tty bs=1 count=1 2> /dev/null
 stty -raw
 stty echo
 stty $SAVEDSTTY
 }
 echo ""
 echo -e "\033[47;30m * Press any key to start installing PPTP VPN \033[0m"
 echo -e "\033[47;30m * Or press Ctrl+C to cancel the installation \033[0m"
 char=`get_char`
 echo ""

## Start ##
 echo "nameserver 8.8.8.8
 nameserver 8.8.4.4
 search localdomain" >> /etc/resolv.conf
 service network restart

yum remove -y pptpd ppp
 iptables --flush POSTROUTING --table nat
 iptables --flush FORWARD
 rm -rf /etc/pptpd.conf
 rm -rf /etc/ppp

arch=`uname -m`
 wget http://poptop.sourceforge.net/yum/stable/packages/pptpd-1.3.4-2.el6.$arch.rpm
 wget http://poptop.sourceforge.net/yum/stable/packages/ppp-2.4.5-23.0.rhel6.$arch.rpm
 wget http://poptop.sourceforge.net/yum/stable/packages/kernel_ppp_mppe-1.0.2-3dkms.noarch.rpm
 wget http://poptop.sourceforge.net/yum/stable/packages/dkms-2.0.17.5-1.noarch.rpm
 yum -y update
 yum -y upgrade
 yum -y install make libpcap iptables gcc-c++ logrotate tar cpio perl pam tcp_wrappers policycoreutils
 rpm -ivh dkms-2.0.17.5-1.noarch.rpm
 rpm -ivh kernel_ppp_mppe-1.0.2-3dkms.noarch.rpm
 rpm -qa kernel_ppp_mppe
 rpm -Uvh ppp-2.4.5-23.0.rhel6.$arch.rpm
 rpm -Uvh pptpd-1.3.4-2.el6.$arch.rpm

rm -r /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.10.1" >> /etc/pptpd.conf
 echo "remoteip 10.0.10.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 "OTW pptpd ${pass} *" >> /etc/ppp/chap-secrets

iptables -t nat -A POSTROUTING -s 10.0.10.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.10.0/24 -j TCPMSS --set-mss 1356
 iptables -I FORWARD -p tcp --syn -i ppp+ -j TCPMSS --set-mss 1356
 service iptables save

chkconfig iptables on
 chkconfig pptpd on

service iptables start
 service pptpd start

## Completed ##
 echo ""
 echo -e "\033[44;37m ###################################### \033[0m"
 echo -e "\033[44;37m #   PPTPD Installer for CentOS 6.x   # \033[0m"
 echo -e "\033[44;37m #                                    # \033[0m"
 echo -e "\033[44;37m #    The original from DiaHosting    # \033[0m"
 echo -e "\033[44;37m #                                    # \033[0m"
 echo -e "\033[44;37m # Modify by Jetso / Date: 2012-12-15 # \033[0m"
 echo -e "\033[44;37m #                                    # \033[0m"
 echo -e "\033[44;37m #   Weibo: http://t.qq.com/jetsor    # \033[0m"
 echo -e "\033[44;37m #                                    # \033[0m"
 echo -e "\033[44;37m #           Version: 1.0             # \033[0m"
 echo -e "\033[44;37m ###################################### \033[0m"
 echo ""
 echo -e "VPN service is installed, your username is\033[32m OTW\033[0m, password is\033[32m ${pass}\033[0m"
 echo ""

PPTPD一键安装包

系统要求:CentOS 5 32bits/64bits。

使用方法:

wget http://www.diahosting.com/dload/pptpd.sh
sh pptpd.sh

安装完成后会提示vpn用户名和密码。

VPN用户管理:
直接编辑/etc/ppp/chap-secrets文件,按照相同格式添加用户名和密码即可。

赞(0) 打赏
未经允许不得转载:毛桃博客 » v-p-n安装指南

评论 抢沙发

评论前必须登录!

 

实践是学习的最佳途径

支持快讯、专题、百度收录推送、人机验证、多级分类筛选器,适用于垂直站点、科技博客、个人站,扁平化设计、简洁白色、超多功能配置、会员中心、直达链接、文章图片弹窗、自动缩略图等...

了解更多看平潭

觉得文章有用就打赏一下文章作者

非常感谢你的打赏,我们将继续给力更多优质内容,让我们一起创建更加美好的网络世界!

支付宝扫一扫打赏

微信扫一扫打赏

登录

找回密码

注册