Rapsberry Pi PPTP VPN server.

FIRST:

sudo apt-get update
 [ENTER]
 sudo apt-get upgrade

Then check MPPE support:

sudo modprobe ppp-compress-18
 [ENTER]


No errors? You are good to go!

Next, install the PPTP server package:

sudo apt-get install pptpd

[ENTER]

 

Now edit the pptp.conf file:

sudo nano /etc/pptpd.conf
 [ENTER]

At the end of the file, uncomment the following lines

localip 192.168.0.1
remoteip 192.168.1.234-238,192.168.1.245

And change the “localip” to your raspberry pi ip adres
Remoteip = are the addresses that will be handed out to clients.

Hit Control + X To close and save the file.

PPTPvpn1

Now, edit the ‘/etc/ppp/pptpd-options’ file.

sudo nano /etc/ppp/pptpd-options
[ENTER]

Add the follow txt on the bottom:

ms-dns 192.168.1.1
noipx
mtu 1490
mru 1490

Where the IP used for the ms-dns directive is the DNS server for the local network to which your client will be connecting (quite possibly the IP address of your router). Hit Control + X to close/save the file. Next, edit the ‘/etc/ppp/chap-secrets’ files. This is where you will place your credentials for logging into the VPN server. sudo nano /etc/ppp/chap-secrets

[ENTER]

Add your authentication credentials in the following form:

username[TAB]*[TAB]password[TAB]*

 

It looks like this:

PPTPvpn2

Control + X to close/save the file.

Now restart the PPTP vpn server with:

sudo service pptpd restart
[ENTER]

Now, enable forwarding if you wish to have access to your entire home network while away. Edit the ‘sysctl’ file.

sudo vi /etc/sysctl.conf
[ENTER]

Find “net.ipv4.ip_forward=1” and uncomment it (or change =0 to =1)

CONTROL + X to close/save the file.

to enable forwarding. Now, execute the following command to apply change

sudo sysctl -p
[ENTER]

Last step: Adding iptables rules

sudo nano /etc/rc.local
[ENTER]

Add this line just above “exit 0”

sudo iptables -t nat -A POSTROUTING -s 192.168.0.234/24 -o eth0 -j SNAT --to IPADRESOFYOURRASPBERRYPI

Hit left control + x and save the file.

(The 192.168.0.234 is the begin first ip adres handed out by the vpn server)

Now forward port 1723 in your router/modem

You are ready to go!