Skip to main content

[Ubuntu/Debian] How To Set Up Your VPN With PPTP

Updated this week

Introduction

A virtual private network, also known as a VPN, is a private network that extends across a public network or the internet. It enables users to send and receive data across shared or public networks as if their computing devices were directly connected to the private network. From all of the possible options, the most optimal ones are between PPTP and OpenVPN.

A Point-To-Point Tunneling Protocol (PPTP) allows you to implement your own VPN very quickly and is compatible with most mobile devices. Even though PPTP is less secure than OpenVPN, it is also faster and uses fewer CPU resources.

Requirements

In Time4VPS Standard VPS, the PPTP module is not enabled by default, and it can only be used in our KVM Linux VPS.


Installation

After the PPTP module is enabled from our side, we can start installing it:

apt-get install pptpd

Now you should edit /etc/pptpd.conf:

nano /etc/pptpd.conf

and add the following lines:

localip 10.0.0.1
remoteip 10.0.0.100-200

Next, you should set up authentication for PPTP by adding users and passwords:

nano /etc/ppp/chap-secrets

It should look like this (we added one test user):

# Secrets for authentication using CHAP
# client server secret IP addresses
vpnuser pptpd password *

Where client is the username, server is type of service – pptpd for our example, secret is the password, and IP addresses specifies which IP address may authenticate. By setting ‘*’ in IP addresses field, you specify that you would accept username/password pair for any IP.

Adding DNS servers

Now we need to add DNS servers to /etc/ppp/pptpd-options. Open file:

nano /etc/ppp/pptpd-options

And uncomment (delete "#" symbols at the beginning of the lines) these lines:

ms-dns 8.8.8.8
ms-dns 8.8.4.4

After this restart PPTPD:

service pptpd restart

Setup Forwarding

To enable IPv4 forward change /etc/sysctl.conf file:

nano /etc/sysctl.conf

By uncommenting the line:

net.ipv4.ip_forward=1

To make changes active, run:

sysctl -p

Adding iptables

Execute this command to add an iptables rule:

iptables -t nat -A POSTROUTING -o venet0 -j MASQUERADE

Conlusion

You are done. Just reboot your server, and you should be able to connect using PPTPD and send all your traffic through this server.

Did this answer your question?