PPTP Server on Ubuntu Server

Easy way to configure PPTP server on Ubuntu Server 12.04.

First, install PPTP server:

sudo apt-get install pptpd

Configuring the PPTPD server

Now, edit /etc/pptpd.conf

You need to edit localip= and remoteip= lines to match your network.

Ideally, you want to specify the local and remote IP address on your network but off your DHCP range.

Example: I’m using 10.0.1.x addresses on my lan, with subnet mask 255.255.255.0. I could easily use the following:

localip=10.0.2.1
remoteip=10.0.2.100-199

(Any IP ranges over MAX_CONNECTIONS (100) are ignored. )

Note that although 10.0.2.x is technically off my subnet mask, I can use it.

Next, edit /etc/ppp/chap-secrets

Specify username / password combinations in the form

username * password *

Edit /etc/ppp/pptpd-options and uncomment the ms-dns lines and add valid nameservers. Use your ISP’s nameservers, Google’s nameservers, OpenDNS nameservers, or whichever.

If you are running your pptpd server on a hosted VPS, also comment out the proxyarp directive.

Configuring the firewall:

Now, enter the following at the command line to set firewall rules to allow connections

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A INPUT -i eth0 -p tcp --dport 1723 -j ACCEPT
iptables -A INPUT -i eth0 -p gre -j ACCEPT

If you are going to be routing all traffic through the VPN, also do the following few steps:

iptables -A FORWARD -i ppp+ -o eth0 -j ACCEPT
iptables -A FORWARD -i eth0 -o ppp+ -j ACCEPT

and edit the /etc/sysctl.conf file and uncomment (or add):

net.ipv4.ip_forward=1

Refresh sysctl by doing:

sysctl -p

Finally, restart the pptpd server

service pptpd restart
Advertisements

, ,