CentOS 7 快速部署 PPTP VPN 服務
將下列 script 儲存成 build-pptp.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 
38 
39 
40 
41 
42 
43 
44 
45 
46 
47 
48 
49 
50 
51 
 | 
 yum –y install http://mirror01.idc.hinet.net/EPEL/7/x86_64/e/epel-release-7-5.noarch.rpm 
yum –y install ppp pptpd 
cp /etc/pptpd.conf /etc/pptpd.conf.bak 
cat >/etc/pptpd.conf<<EOF 
option /etc/ppp/options.pptpd 
logwtmp 
localip 10.0.10.1 
remoteip 10.0.10.2–254 
EOF 
cp /etc/ppp/options.pptpd /etc/ppp/options.pptpd.bak 
cat >/etc/ppp/options.pptpd<<EOF 
name pptpd 
refuse–pap 
refuse–chap 
refuse–mschap 
require–mschap–v2 
require–mppe–128 
proxyarp 
lock 
nobsdcomp 
novj 
novjccomp 
nologfd 
ms–dns 8.8.8.8 
ms–dns 8.8.4.4 
EOF 
cp /etc/sysctl.conf /etc/sysctl.conf.bak 
cat >/etc/sysctl.conf<<EOF 
net.core.wmem_max = 12582912 
net.core.rmem_max = 12582912 
net.ipv4.tcp_rmem = 10240 87380 12582912 
net.ipv4.tcp_wmem = 10240 87380 12582912 
net.core.wmem_max = 12582912 
net.core.rmem_max = 12582912 
net.ipv4.tcp_rmem = 10240 87380 12582912 
net.ipv4.tcp_wmem = 10240 87380 12582912 
net.core.wmem_max = 12582912 
net.core.rmem_max = 12582912 
net.ipv4.tcp_rmem = 10240 87380 12582912 
net.ipv4.tcp_wmem = 10240 87380 12582912 
net.ipv4.ip_forward = 1 
EOF 
sysctl –p 
chmod +x /etc/rc.d/rc.local 
echo “iptables -t nat -A POSTROUTING -s 10.0.10.0/24 -o eth0 -j MASQUERADE” >> /etc/rc.d/rc.local 
iptables –t nat –A POSTROUTING –s 10.0.10.0/24 –o eth0 –j MASQUERADE 
 | 
完成後,執行 build-pptp.sh
| 
 1 
 | 
 root # ./build-pptp.sh 
 | 
編輯 /etc/ppp/chap-secrets 可設定使用者帳號密碼
VPNUSER pptpd VPNPASS *
啟動 pptpd 服務
| 
 1 
2 
 | 
 root # systemctl start pptpd 
root # systemctl enable pptpd.service 
 | 
// Steven
					
					