Lifewithtech

View Original

VPN: PPTP Server installation and config

While not the most secure of the VPN solutions out there,

PPTP is by far the simplest to get up and running.

Lets dive right into installing PPTP on a Debian distro. (I'm using Ubuntu server 12.10 64bit)

 


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

localip 192.168.0.2 remoteip 192.168.0.100-150

This sets up the PPTP server to use IP 192.168.0.2 while distributing the IP range 192.168.0.100 to 192.168.0.150 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

ms-dns 192.168.0.1 ms-dns 8.8.4.4 

I Like to use my local DNS server as the primary DNS, This way my local machine addresses will resolve.I do use Google's DNS as my secoundary. 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
1
# 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

net.ipv4.ip_forward=1 

Then reload the configuration

sudo sysctl -p 

Done. Reboot to see if everything goes well.

See this gallery in the original post