Set up and Configure PPTP VPN on Linux

In this article, we want to teach you to Set up and Configure PPTP VPN on Linux.

PPTP stands for Point-to-Point Tunneling Protocol. PPTP operates on TCP port 1723 and is one of the oldest VPN protocols still in use.

The PPTP is one of the most common, fastest, and easiest VPN protocols to set up and configure. because of this, it is useful for applications in which speed is important, like audio or video streaming, and on older, slower devices with more limited processors.

Also, PPTP VPN is not secure. for this reason, it’s not recommended to use. you can use it in cases where security is non-essential.

Set up and Configure PPTP VPN on Linux

In this guide, we teach you how to set up and configure PPTP VPN on all distros of Linux.

Before you set up your own VPN network, you should have one computer that will be the VPN server.

That computer will be responsible for assigning IP addresses to the clients, establishing the initial connection between the clients or between the client and the server, and handling the security protocols and users/clients authentication.

Set up PPTP VPN on Centos / RHEL

PPTP package is available in the EPEL repository. first, update yum packages with the following command:

sudo yum update

after that, you need to add the EPEL repository with the following command:

sudo yum install epel-release

Then, you can install the PPTP service with the following command:

sudo yum install -y pptpd

Set up PPTP VPN on Ubuntu / Debian

To install PPTP VPN on Ubuntu and Debian servers, update the APT packages with the following command:

sudo apt update

Then install PPTP service:

sudo apt-get install pptpd -y

When you are finished with installing the PPTP VPN, let’s start to configure it.

Configure PPTP VPN on Linux

First of all, you need to add DNS servers. you can add the DNS servers provided by or internet provider or you can use Google DNS servers and insert them into the configuration file.

Open the PPTP VPN configuration file on Linux with the following command you can use your favorite text editor here we use vi:

On Ubuntu / Debian

sudo vi /etc/ppp/pptpd-options

On Centos / RHEL

sudo vi /etc/ppp/options.pptpd

Then search for the following lines:

#ms-dns 10.0.0.1
#ms-dns 10.0.0.2

And change them to this, uncomment the lines by removing the # from the line and replace the DNS servers with Google DNS server:

ms-dns 8.8.8.8
ms-dns 8.8.4.4

When you are finished, save and close the file.

After this, you need to add PPTP VPN user accounts on Linux. Use the following command to open the /etc/ppp/chap-secrets file:

sudo vi /etc/ppp/chap-secrets

Then, add the username and password as follows. Use the tab key to separate them.

user1 pptpd user1-password *
user2 pptpd user2-password *

Here, you need to allocate private IP for the VPN server and client.

Open the /etc/pptpd.conf file with the following command:

sudo vi /etc/pptpd.conf

Add the following lines at the end of the file:

localip 10.0.0.1
remoteip 10.0.0.100-200

Save and close the file when you are done.

Note: localip is the IP for your VPN server. remoteip is for VPN clients.

In order for the PPTP server to route packets between the VPN client and the outside world, you need to enable IP forwarding. so, the PPTP server becomes a router.

To do this open the /etc/sysctl.conf file with the following command:

sudo vi /etc/sysctl.conf

Then, add the following line to the file:

net.ipv4.ip_forward = 1

When you are finished save and close the file.

Apply the changes with the following command:

sudo sysctl -p

Here you need to configure the firewall for IP masquerading.

Let’s see how to do this.

Configure the Firewall for IP Masquerading

In order to set up a PPTP VPN, you need to configure the firewall for IP masquerading.

The following command append (-A) a rule to the end of the POSTROUTING chain of the nat table. It will link your virtual private network with the Internet. And also hide your network from the outside world. So the Internet can only see your VPN server’s IP, but can’t see your VPN client’s IP.

Your server’s ethernet card name may not be eth0. You can use the ip address or ip link command to check that.

sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

Note: On Ubuntu / Debian you may face an error that the iptables command is not found. you need to remove the ufw firewall. and install the iptables. then, run the above command.

To remove the ufw on Ubuntu / Debian run the following command:

sudo apt remove ufw

Install iptables with the following command:

sudo apt install iptables

Then, run the iptables command above.

To save this iptables rule permanently, you can put the above command in /etc/rc.local file, so the command will be executed on system boot by root automatically. By the way, you don’t have to add sudo to the commands in the rc.local.

Note: On Ubuntu, it’s recommended to remove the -e part from the first line in rc.local file. If you have the -e option, then when a command in rc.local fails to run, any command below will not be executed.

At this point, you can start the PPTP VPN service on Linux with the following command:

sudo systemctl start pptpd

Then, enable the PPTP VPN on Linux with the following command:

sudo systemctl enable pptpd

Now you need to set up your VPN client and you should be able to connect to your VPN server.

Install PPTP VPN Client on Ubuntu / Debian

Open a terminal and run the following command to install the PPTP VPN client:

sudo apt-get install pptp-linux network-manager-pptp network-manager-pptp-gnome

Install PPTP VPN Client on Centos / RHEL

Open a terminal and run the following command to install the PPTP VPN client:

sudo yum install NetworkManager-pptp NetworkManager-pptp-gnome pptp pptp-setup

Conclusion

Here you learn to set up and configure PPTP VPN on Linux. Also, when you configured the PPTP server, you can connect it from your device like android, ios, and windows with the username and password that you have set.

Hope you enjoy it.

May this article about How To Set up and Configure OpenVPN on Centos 7 be useful for you.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles

POPULAR TAGS

Most Popular