Many may not be familiar with the PPTP configuration in Linux. Below I have written a simple Shell script, which can be directly saved and executed by pptp. sh.
1. Script: yum remove-y pptpd ppp
Iptables -- flush POSTROUTING -- table nat
Iptables -- flush FORWARD
Rm-rf/etc/pptpd. conf
Rm-rf/etc/ppp
Yum-y install make libpcap iptables gcc-c ++ logrotate tar cpio perl pam tcp_wrappers
Yum-y dkms-2.0.17.5-1.noarch.rpm
Yum-y kernel_ppp_mppe-1.0.2-3dkms.noarch.rpm
Rpm-qa kernel_ppp_mppe
Yum-y ppp-2.4.4-9.0.rhel5.i386.rpm
Yum-y pptpd-1.3.4-1.rhel5.1.i386.rpm
Mknod/dev/ppp c 108 0
Echo 1>/proc/sys/net/ipv4/ip_forward
Echo "mknod/dev/ppp c 108 0">/etc/rc. local
Echo "echo 1>/proc/sys/net/ipv4/ip_forward">/etc/rc. local
Echo "localip 192.168.168.1">/etc/pptpd. conf
Echo "remoteip 192.168.168.2-254">/etc/pptpd. conf
Echo "ms-dns 8.8.8.8">/etc/ppp/options.ppt pd
Echo "ms-dns 8.8.4.4">/etc/ppp/options.ppt pd
Pass = 'openssl rand 6-base64'
If ["$1 "! = ""]
Then pass = $1
Fi
Echo "vpn pptpd $ {pass} *">/etc/ppp/chap-secrets
Iptables-t nat-a postrouting-s 192.168.168.0/24-j SNAT -- to-source 'ifconfig | grep' inet addr: '| grep-V' 127. 0.0.1 '| cut-d:-f2 | awk 'nr = 1 {print $1 }''
Iptables-a forward-p tcp -- syn-s 172.16.36.0/24-j TCPMSS -- set-mss 1356
Service iptables save
Chkconfig iptables on
Chkconfig pptpd on
Service iptables start
Service pptpd start
Echo "Enter the connection password $ {pass }"
2. Set the permission to run chmod + X3 and run:/bin/bash pptp. sh4. VPN user management: directly edit the/etc/ppp/chap-secrets file and add the user name and password in the same format.