pptpd安装脚本

脚本网上找的,32位系统适用,内容如下:

#! /bin/sh
# 
### BEGIN INIT INFO
# Provides:          pptpd instll
# PowerBY:     fireye 
# website:     http//www.hichou.com www.qinday.com
# Description:       pptpd install for centos vps
### END INIT INFO
# 

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


wget http://packages.sw.be/dkms/dkms-2.1.1.2-1.el5.rf.noarch.rpm
wget "http://nchc.dl.sourceforge.net/project/poptop/mppe%20module%20builder/kernel_ppp_mppe-1.0.2%20dkms-2.0.6/kernel_ppp_mppe-1.0.2-3dkms.noarch.rpm"
wget http://www.diahosting.com/dload/pptpd-1.3.4-1.rhel5.1.i386.rpm
wget ftp://ftp.ntua.gr/pub/net/poptop/OldFiles/pptpd-1.1.3-1.i386.rpm
wget http://mirrors.163.com/centos/5.6/os/i386/CentOS/ppp-2.4.4-2.el5.i386.rpm

yum -y install make libpcap iptables gcc-c++ logrotate tar cpio perl pam tcp_wrappers
rpm -ivh dkms-2.1.1.2-1.el5.rf.noarch.rpm
rpm -ivh kernel_ppp_mppe-1.0.2-3dkms.noarch.rpm
rpm -qa kernel_ppp_mppe
rpm -Uvh ppp-2.4.4-2.el5.i386.rpm
rpm -ivh pptpd-1.3.4-1.rhel5.1.i386.rpm

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 172.16.36.1" >> /etc/pptpd.conf
echo "remoteip 172.16.36.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 172.16.36.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 172.16.36.0/24 -j TCPMSS --set-mss 1356
iptables -A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 1723 -j ACCEPT 
iptables -A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 47 -j ACCEPT 

service iptables save
chkconfig iptables on
chkconfig pptpd on

service iptables start
service pptpd restart

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

发表评论

电子邮件地址不会被公开。 必填项已用*标注