Raspberry Pi – VPN server with PPTP

In this document we will see in a very simple way how to mount a VPN server on our Raspberry Pi, it will be a PPTP server that will be something basic to connect from the internet to our homes/small businesses, quite useful, especially if we have services that we want to access and do not want to give public access. If we don't have a fixed public IP, would be ideal combine it with the NO-IP client on our Raspberry!!!

 

raspberry-vpn-bujarra
So by following these few steps we will be able to access our home or small business, remember that PPTP is not the safest thing to do, I'll show you in another document how to set it up with OpenVPN! For now, it will be enough to connect us to the necessary resources and not have to expose them to the internet, obviously we can configure the VPN client on our Android smartphones, iPhone or iPad, as well as on Windows computers, Linux, Mac…

[SourceCode]Sudo ModProbe PPP-COMPRESS-18
sudo apt-get install pptpd[/SourceCode]

First of all, we will need to enable MPPE support, then we installed the VPN server for Raspbian, based on PPTP.

 

[SourceCode]sudo vim /etc/pptpd.conf
Localip 192.168.1.200
Remoteip 192.168.1.30-33[/SourceCode]

We will edit the configuration file '/etc/pptpd.conf’ and we will indicate in 'localip’ the local IP address of the Raspberry Pi, in 'remoteip’ the IP range it will give to clients who connect to the VPN.

 

[SourceCode]sudo vim /etc/ppp/pptpd-options
ms-dns 192.168.1.1
Noobsdcomp
Noipx
Mtu 1490
Mru 1490[/SourceCode]

We edit the file '/etc/ppp/pptpd-options’ and we add the above text, we will need to configure the correct DNS server, it could be the same 8.8.8.8, Depends on.

 

[SourceCode]sudo vi /etc/ppp/chap-secrets
user[TAB]*[TAB]contraseña[TAB]*[/SourceCode]

Now we create the user to access the VPN, We must generate the contents of the file with the correct format and the appropriate tabs.

 

[SourceCode]sudo service pptpd restart[/SourceCode]

We restart the service for the changes to take effect!

 

[SourceCode]sudo vim /etc/sysctl.conf
net.ipv4.ip_forward=1[/SourceCode]

If we are interested in redirecting from the Raspberry to other computers on the network, we must allow redirection from the Raspberry to other computers on the network, Because if not, when connecting from the outside we will only be able to access the Raspberry and not the other devices at home, We uncomment the previous line in the file '/etc/sysctl.conf'.

 

[SourceCode]sudo sysctl -p[/SourceCode]

We apply the changes and that's it! now we would only have to open port 1723tcp on our router to the IP that our beloved Raspberry Pi has.

 

Raspberry-VPN-01-Bujarra
We can easily configure, for example, the VPN client on iOS, since “Settings” > “General” > “VPN” > “Add VPN Settings…” > Select 'PPTP', on 'Server’ we will put the public IP of our house or the name of NO-IP that we have, in 'Account’ the user created for the VPN, under 'Password'’ Your password, and by default we leave the rest as it is and it should connect us without problems!!!

Recommended Posts

Author

nheobug@bujarra.com
Autor del blog Bujarra.com Cualquier necesidad que tengas, Do not hesitate to contact me, I will try to help you whenever I can, Sharing is living ;) . Enjoy documents!!!

Raspberry Pi - NO-IP Server

14 of July de 2014