Tuesday, September 5, 2017

Installing PPTP on CentOS 7 OpenVZ




Although PPTP is not the most secure VPN, it's easy to setup and use.


Make sure PPTP is enabled on the server

Run the below command
cat /dev/ppp

If you get the below, it means it's enabled
cat: /dev/ppp: No such device or address



If you don't see that message, you will have to enable it, usually from SolusVM from your host control panel. Or you can ask your host.


Login to your server as root


Install Latest EPEL Release
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

Install PPTPD
yum -y install ppp pptpd

Configure IP Ranges
Open  /etc/pptpd.conf
vi /etc/pptpd.conf

And add at the end the 2 following lines:
localip 10.10.0.1 
remoteip 10.10.0.100-199


Configure DNS
Open /etc/ppp/options.pptpd
vi etc/ppp/options.pptpd

And add at the end of the file
ms-dns 8.8.8.8 
ms-dns 8.8.4.4

Add Username & Password
Open /etc/ppp/chap-secrets
vi /etc/ppp/chap-secrets

Add the below
USERNAME pptpd PASSWORD *

Where USERNAME is a username of your choice and PASSWORD is a password of your choice


Setup IPv4 Forward
Open /etc/sysctl.conf
vi /etc/sysctl.conf

Add or change the below to 1
net.ipv4.ip_forward = 1

Save & Exit and run the following command for the changes to take effect
sysctl -p

Configure Firewalld

Add the below to Firewalld
firewall-cmd --permanent --zone=public --add-service=pptp
firewall-cmd --permanent --zone=public --add-masquerade
firewall-cmd --reload


Start & Enable on Startup

Start PPTD
systemctl start pptpd

Enable at startup
systemctl enable pptpd.service



Questions or comments? Leave them below!