How to set up a PPTP VPN server on Ubuntu

Nowadays free public WiFi networks are available in many areas, for example in airports, restaurants or public transportation. A major disadvantage of a public WiFi network is security. You can’t be sure no one stealing sensitive data by eavesdropping the connections. A solution is to setup a secure/encrypted channel to a Virtual Private Network (VPN). When using a VPN and you connect to for instance your webmail, the data is sent via the VPN. In this post I’ll describe how to set up a PPTP VPN server on Ubuntu. Using PPTP you can not only connect your laptop, but also your Android or iOS (iPhone or iPad) devices.

The network schema I’ll use in this tutorial is as follows (thanks to Bas van Dijk for the schema template):

In this schema the client is a VPN client (e.g. a laptop or smartphone) and the server is running the PPTP service. The IP addresses are local addresses. The basic idea is that the client opens a VPN connection to the server. When connected successfully all data traffic from the client is sent to the VPN server first via a secure channel, and then sent to the actual destination on the internet. Data sent back from the destination to the client is sent via the VPN server as well.

Installing PPTPD on Ubuntu

First install PPTPD by using the following command (for all commands su or sudo is required):

Open the PPTPD configuration in a text editor:

Add/edit the following settings:

Open the user configuration in a text editor:

Add the following line to add a user:

Enable packet forwarding for IPv4, first open sysctl.conf in a text editor …

… and uncomment the following line:

Restart the PPTPD service:

In your router forward port 1723 TCP to port 1723 TCP of your Ubuntu server ( in my case).

Connect an Android device to the PPTP VPN server

In Android go to Settings > Wireless & Networks > VPN. Press Add VPN network and use the following settings:

Press Save and connect to the VPN server by using your PPTP user name and password. When connected successfully a key-icon will apear in the status bar. In order to verify all data is routed via the VPN server navigate to and check if the IP address shown is the same as the router’s outgoing IP address (the IP address provided by your ISP).

Connect an iOS device to the PPTP VPN server

Go to Settings > General > Network > VPN > Add VPN Configuration. Use the following settings:

Press Save and switch the VPN button to On. When connected successfully a VPN icon will appear in the status bar. You can verify the connection by using the instructions described in the Android section.

In my configuration there’s a problem accessing web pages in safari when the VPN is connected. In the comments of this blog post I found there might be a problem with the 192.168.x.x local IP addresses of the VPN server and the local IP range of the WiFi network the iOS device is connected to. Some comments say a solution is to change the VPN server’s network to the 10.0.x.x network range, but I haven’t tried that yet.


7 thoughts on “How to set up a PPTP VPN server on Ubuntu

  1. hi,

    i have also pptpd on ubuntu server, i have similer settings.

    i want my VPN clients to see my entire, server network. or at least the possibilty to connect/ping. in the past i had managed it but then ubuntu crashed 😮 and i lost all my configs.

    the setting is as followed:

    client —vpn—(pptpd ubuntu server1)–> windows server 2008 server 2.

    do u know a solution?

  2. Hi Jacko,
    I have never used this setup, so unfortunately I don’t know. Are you sure this is possible with pptpd? Maybe this OpenVPN is a better solution for this setup.

  3. I’ve read in another blog (sorry, I couldn’t find it….old age setting in) that openVPN does not work with the iPad. Do you know off hand if this is correct?

    Thank you for a great article.


  4. Hi Marthijn,
    I am following these setting to connect android phone with ubuntu machine but android vpn is not connecting prompting that therew is no netwrok. Any idea?

  5. I also have problem connecting Android 4.2.2 to this pptp server.
    It works on my Linux laptop as well as iOS 7 devices, but the Android device fails.

    There must be some unchangeable setting in Android that doesn’t work with this setting. I’m wondering what I can change in the server’s setting, so all my devices can connect to it.

Leave a Reply

Your email address will not be published. Required fields are marked *