[Ubuntu/Debian] How To Setup Your VPN With PPTP
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.confand add the following lines:
localip 10.0.0.1Next, you should setup authentication for PPTP by adding users and passwords:
It should look like this (we added one test user):
# Secrets for authentication using CHAPWhere 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.
# client server secret IP addresses
vpnuser pptpd password *
Adding DNS servers
Now we need to add DNS servers to /etc/ppp/pptpd-options. Open file:
And uncomment (delete "#" symbols in the beginning of the lines) these lines:
ms-dns 126.96.36.199After this restart PPTPD:
service pptpd restart
To enable IPv4 forward change /etc/sysctl.conf file:
By uncommenting the line:
To make changes active, run:
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.