Build a VPN Server under CentOS6.2
1.Install using yumPpp:
$ yuminstallppp-y
2. Download and install pptpd. You can obtain it on this website.Http://poptop.sourceforge.net/yum/stable/packages/:
(Depends on the number of digits in the operating system. Here is the 64-bit x86_64 version)
$cd/usr/local/src $wgethttp://poptop.sourceforge.net/yum/stable/packages/pptpd-1.3.4-2.el6.x86_64.rpm $ rpm -Uhvpptpd-1.3.4-2.el6.x86_64.rpm
3. After installation, open/Etc/pptpd. confAdd or modify the following Configuration:
localip 192.168.0.1 remoteip 192.168.0.234-238
4. Open/Etc/ppp/options.ppt pdAdd the dns of the vpn (use google dns ):
ms-dns 8.8.8.8
5. Add an account to the vpn and open/Etc/ppp/chap-secretsAdd the user name and password in the following format:
vpnuser pptpd myVPN$99 *
The format is as follows:[Username] [space] [server] [space] [password] [space] [IP addresses]
6. We need to enable IP Forwarding for the service./Etc/sysctl. confChange the following Configuration:
net.ipv4.ip_forward =1
# Net. ipv4.tcp _ syncookies = 1 comment out this line
7. Run the following command to make the configuration take effect:
$ sysctl-p
8. Add Rules to the firewall to allow NAT Translation:
$ iptables-tnat-APOSTROUTING-oeth0-jMASQUERADE
$ service iptables save
$ service iptables restart
Note: check when you finish Step 8./Etc/sysconfig/iptables. Make sure that the POSTROUTING rule is before any REJECT rule.
Depending on the Implementation of VPS, there are mainly openVZ and XEN. These two rules are:
OpenVZ:$ Iptables-t nat-a postrouting-s 192.168.0.0/24-j SNAT -- to-source **. ** (VPS public IP address is used here)
XEN: iptables-t nat-a postrouting-s 192.168.0.0/24-o eth0-j MASQUERADE
9.EnablePptpd Service self-start and re-Server
$ chkconfig pptpd on
$ init6
After the system is restarted, you can connect to the server through the VPN Client. You can view/Var/log/messageForPppAndPptpdRelated logs.
Reference: http://blog.secaserver.com/2011/10/install-vpn-pptp-server-centos-6/