Centos 7 安装V*N(pptpd)脚本

DwaHTHQ 8年前

来自: http://my.oschina.net/sunchp/blog/617784


#!/bin/bash

yum install -y perl

rpm -ivh http://dl.fedoraproject.org/pub/epel/7/x86_64/p/pptpd-1.4.0-2.el7.x86_64.rpm

 

echo "ms-dns 8.8.8.8" >> /etc/ppp/options.pptpd

echo "ms-dns 8.8.4.4" >> /etc/ppp/options.pptpd

 

echo "localip 9.9.0.1" >> /etc/pptpd.conf

echo "remoteip 9.9.0.10-200" >> /etc/pptpd.conf

 

echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf

sysctl -p

 

firewall-cmd --permanent --direct --add-rule ipv4 filter INPUT 0 -i eth0 -p tcp --dport 1723 -j ACCEPT

firewall-cmd --permanent --direct --add-rule ipv4 filter INPUT 0 -p gre -j ACCEPT

firewall-cmd --permanent --direct --add-rule ipv4 filter POSTROUTING 0 -t nat -o eth0 -j MASQUERADE

firewall-cmd --permanent --direct --add-rule ipv4 filter FORWARD 0 -i ppp+ -o eth0 -j ACCEPT

firewall-cmd --permanent --direct --add-rule ipv4 filter FORWARD 0 -i eth0 -o ppp+ -j ACCEPT

firewall-cmd --reload

 

echo "account pptpd password *" >> /etc/ppp/chap-secrets

 

systemctl restart pptpd

netstat -an|grep tcp|grep 1723