Skip to content

Commit

Permalink
简化代码,修改bug
Browse files Browse the repository at this point in the history
  • Loading branch information
91yun committed May 3, 2016
1 parent 3049c78 commit 0ba248e
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions vpn_centos_pptpd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,32 @@ function installVPN(){
#check wether vps suppot ppp and tun

#判断centos版本
yum install redhat-lsb -y
yum install wget vim curl -y
yum install epel-release
ver1str="lsb_release -rs | awk -F '.' '{ print \$1}'"
ver1=$(eval $ver1str)
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把默认防火墙关了。
yum install iptables-services -y
systemctl stop firewalld.service
systemctl disable firewalld.service
yum install iptables-services -y
#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 @@ -57,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 0ba248e

Please sign in to comment.