How to setup pptp VPN server on Linux [Tutorial]

I’m moving to Japan very soon and remembered that Google Voice won’t be working once I step onto Land of the Rising Sun. So I figured I should setup a VPN tunneling for me to access services that is available only in the US. Setting up PPTPD is fairly easy and straight forward. I’m using SoftLayer BYOC (Build Your Own Cloud) which cost $70/month for 2TB bandwidth (inbound bandwidth is free – unlike Rackspace cloud).

I picked the Ubuntu 10.04 Lucid Lynx for this example, but you can use any distro you prefer.

First, you need to install the PPTP daemon (server), and we are going to use apt-get to install it.

apt-get install pptpd

Once it is installed, let’s create user accounts for your VPN server by editing the chap-secrets file. Use any editor you like, I personally prefer Nano.

nano -w /etc/ppp/chap-secrets

Each users should be added in new line with following structure

yourusername pptpd yourpassword *

Next step is to configure localip/remoteip assignment on pptpd.conf

nano -w /etc/pptpd.conf

Since my local router is on, I wanted to avoid using the same IP assignment for my VPN connection. so I’m using instead on pptpd.conf


Now, let’s get IP forwarding working by editing sysctl.conf file

nano -w /etc/sysctl.conf

then uncomment this line


Save the file and reload the configuration.

sysctl -p

Next is to edit rc.local file for iptables rule

nano -w /etc/rc.local

Add these line right above exit line. (eth1 is my public ethernet port, adjust as needed)

/sbin/iptables -t nat -A POSTROUTING -s -o eth1 -j MASQUERADE
/sbin/iptables -I FORWARD -p tcp -syn -i ppp+ -j TCPMSS -set-mss 1356

Last but not least, let’s define the DNS to use with our pptpd. Currently I’m using Google Public DNS – It is fast and reliable; I know some of you prefer OpenDNS.

nano -w /etc/ppp/options

Uncomment the entries with ms-dns and then replace the IP with Google Public DNS IPs so it look like this


You are done! Next is just reboot your server and you should be able to connect to using PPTPD and send all your traffic thru this server. For more pptpd.conf reference, you can find them here.

If you have tips,comment, or unable to get it to work feel free to post them here. Next I will post a tutorial on how to setup a proxy server using squid.

2 comments on “How to setup pptp VPN server on Linux [Tutorial]”

  1. Thanks this helped me 🙂 One correction, your set MSS command should be something like:
    iptables -I FORWARD -p tcp –tcp-flags SYN,RST SYN -i ppp+ -j TCPMSS –set-mss 1356
    (at least on Ubuntu 14.04 that is…)

Leave a Reply

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