Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Register

[Ubuntu/Debian] How To Setup Your VPN With PPTP

LawrenceLawrence Member
edited August 2017 in Linux Applications


A virtual private network also known as a VPN is a private network that extends across a public network or 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 less CPU resources.


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


After 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:
Next, you should setup 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 in the beginning of the lines) these lines:
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:


To make changes active, run:

sysctl -p

Adding iptables

Execute this command to add iptables rule:

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


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


  • To all worked after restarting VPS:

    systemctl enable pptpd
    iptables -t nat -A POSTROUTING -o venet0 -j MASQUERADE
    iptables-save > /etc/iptables.up.rules

    Create file:

    nano /etc/network/if-pre-up.d/iptables

    File Contents:
    #!/bin/sh iptables-restore < /etc/iptables.up.rules
    Save the file

    chmod +x /etc/network/if-pre-up.d/iptables

Sign In or Register to comment.


Learn how to install a web and database server, email, FTP client or other applications. Discover and share information on server security or optimization recommendations.
Feel free to join our constantly expanding community, participate in discussions, strengthen your knowledge on Linux and Windows server management!
© 2013 - 2024 Time4VPS. All rights reserved.

Get In Touch