Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/test'
Browse files Browse the repository at this point in the history
  • Loading branch information
91yun committed May 3, 2016
2 parents b543c80 + 0ba248e commit 79337dc
Showing 1 changed file with 16 additions and 22 deletions.
38 changes: 16 additions & 22 deletions vpn_centos_pptpd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,32 @@ function installVPN(){
#check wether vps suppot ppp and tun

#判断centos版本
yum install redhat-lsb -y
yum install wget vim curl -y
ver1str="lsb_release -rs | awk -F '.' '{ print \$1}'"
ver1=$(eval $ver1str)
if [ "$ver1" == "6" ]; then
rpm -Uvh http://download.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
elif [ "$ver1" == "5" ]; then
rpm -Uvh http://download.fedoraproject.org/pub/epel/epel-release-latest-5.noarch.rpm
elif [ "$ver1" == "7" ]; then
rpm -Uvh http://download.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
if grep -Eqi "release 5." /etc/redhat-release; then
ver1='5'
elif grep -Eqi "release 6." /etc/redhat-release; then
ver1='6'
elif grep -Eqi "release 7." /etc/redhat-release; then
ver1='7'
fi

yum install curl -y
yum install epel-release -y

if [ "$ver1" == "7" ]; then
#centos7要安装iptables把默认防火墙关了。
systemctl stop firewalld.service
systemctl disable firewalld.service
yum install iptables-services -y
yum install policycoreutils -y
systemctl stop firewalld
systemctl mask firewalld
#centos7需要加这个权限,否则不会开机自动执行
chmod +x /etc/rc.d/rc.local
fi

#先删除已经安装的pptpd和ppp
yum remove -y pptpd ppp
iptables --flush POSTROUTING --table nat
iptables --flush FORWARD
rm -rf /etc/pptpd.conf
rm -rf /etc/ppp






rpm -Uvh http://poptop.sourceforge.net/yum/stable/rhel6/pptp-release-current.noarch.rpm

yum install -y ppp pptpd

#写配置文件
Expand All @@ -62,7 +56,7 @@ function installVPN(){
iptables -I INPUT -p tcp -m tcp --dport 1723 -j ACCEPT
service iptables save

if [ "ver1" == "7"]; then
if [ "ver1" == "7" ]; then
systemctl enable iptables.service
systemctl enable pptpd.service
systemctl restart iptables.service
Expand Down

0 comments on commit 79337dc

Please sign in to comment.