forked from wendyeq/pptpd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpptpd_i686.sh
37 lines (28 loc) · 962 Bytes
/
pptpd_i686.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
SUBNET=$1
if [ -z "${SUBNET}" ]; then
SUBNET=192.168.0
fi
yum remove -y pptpd ppp
iptables --flush POSTROUTING --table nat
rm -rf /etc/pptpd.conf
rm -rf /etc/ppp
wget https://github.com/wendyeq/pptpd/raw/master/pptpd-1.3.4-2.el6.i686.rpm
yum install -y ppp
rpm -ivh pptpd-1.3.4-2.el6.i686.rpm
echo "localip ${SUBNET}.1" >> /etc/pptpd.conf
echo "remoteip ${SUBNET}.234-238,${SUBNET}.245" >> /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
sed -i 's/net.ipv4.ip_forward = 0/net.ipv4.ip_forward = 1/' /etc/sysctl.conf
sed -i 's/net.ipv4.tcp_syncookies = 1/#net.ipv4.tcp_syncookies = 1/' /etc/sysctl.conf
sysctl -p
iptables -t nat -A POSTROUTING -s ${SUBNET}.0/24 -o eth0 -j MASQUERADE
/etc/init.d/iptables save
chkconfig pptpd on
service iptables start
service pptpd start