How to Installing Poptop (pptpd) VPN Server on CentOS 6.3

There are mainly 3 types of VPN servers: Point-to-Point Tunneling Protocol (PPTP), Layer 2 Tunneling Protocol (L2TP) and OpenVPN. In this tutorial, we use PPTP because it is supported natively on almost all devices, WindowsLinux, Android, IOS and Mac OS.

Installation

I always prefer installation via a yum repository as this will ensure patches are applied during regular system updates
$ sudo rpm --import http://poptop.sourceforge.net/yum/RPM-GPG-KEY-PPTP
$ sudo rpm -Uvh http://poptop.sourceforge.net/yum/stable/rhel6/pptp-release-current.noarch.rpm
$ sudo yum install ppp pptpd -y

Configuration

Note: replace $USERNAME and $PASSWORD with actual values
IP configuration
$ sudo vi /etc/pptpd.conf
localip 10.10.10.10
remoteip 10.10.10.100-200
DNS configuration
$ sudo vi /etc/ppp/options.pptpd
ms-dns 8.8.8.8
ms-dns 4.4.4.4
Authentication configuration
$ sudo vi /etc/ppp/chap-secrets
vpnuser pptpd yourpassword *
Start PPTP VPN server
$ sudo service pptpd restart
Enable network forwarding in /etc/sysctl.conf
$ sudo vi /etc/sysctl.conf
net.ipv4.ip_forward = 1
use the following command to apply the change:
$ sudo sysctl -p
Firewall config
$ sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
$ sudo iptables -A INPUT -i eth0 -p tcp --dport 1723 -j ACCEPT
$ sudo iptables -A INPUT -i eth0 -p gre -j ACCEPT
$ sudo service iptables save
$ sudo service iptables restart
Turn on the pptpd service at startup and reboot the server:
$ sudo chkconfig pptpd on
Now you can test the VPN server from any client: Windows PCs, Linux PCs, Android phones/tablets, or iPhone and iPad.
The log of the VPN server, by default, is combined with system log located at /var/log/messages.