Configure PPTP VPN on Ubuntu

Here is a quick tutorial to set up a basic PPTP VPN server on Ubuntu 10.04.

Install necessary packages

sudo aptitude install ppp pptpd iptables

Configure PPTP IP ranges on the server

sudo vim /etc/pptpd.conf

At the bottom of the file add


This sets up the PPTP server to use IP while distributing the IP range to to PPTP clients. Change these as you wish as long as they are private IP addresses and do not conflict with IP addresses already used by your server.

Configure DNS servers to use when clients connect to this PPTP server

sudo vim /etc/ppp/pptpd-options

Find lines containing ms-dns and add


to use Google's DNS service. You can specify other DNS servers if you know their addresses.

Now add a test account

sudo vim /etc/ppp/chap-secrets

Append a line at the bottom

# client    server  secret          IP addresses
test    pptpd   abcd1234    *

Configure NAT for PPTP connections, otherwise you cannot reach anywhere from this server

sudo vim /etc/rc.local

adding to the bottom right before exit 0

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

Enable IPv4 forwading

sudo vim /etc/sysctl.conf

Uncomment the line


Then reload the configuration

sudo sysctl -p

Done. Reboot to see if everything goes well.