Server VPN with Raspberry Pi

Hi everyone today I’m gonna show you how to create a server VPN with Raspberry Pi, it’s cool project that allows you tu have a secure and anonimous internet connection. A VPN transfer your internet traffic through a secure server and this server locate you in a fake position so you can bypass all the system that use location.

All the “homemade” VPN also allows you to use all the file in your computer on your smartphone,tablet or other computer connected as the same VPN, It’s a great alternative to modern Cloud that sometimes we have to pay some money.

Material

Software

First of all we need to prepare SD card with OS and as always we have to install Raspbian, if you don’t know how to do this I create a guide at this link to install it with Windows,Linux and Mac.

Now we need to setup a static ip address, port forwarding and install OpenVPN. All of this steps are not very simple and sometimes you can have some problem so we use a script created by PiVPN that do all the steps for you!

After we have installed Raspbian we need to change the log-in password so put in the terminal:

sudo passwd

this command allows you to change the default password of your Raspberry Pi that is raspberry, after that put in the terminal:

curl -L https://install.pivpn.io | bash

And the installation of the software that you need to create a VPN starts, during the installation you need to choose some option that I show you in the video below, the only things you have to pay attention is click YES on Unattended Upgrade, se protocol UDP and change the port of OpenVPN from 1194 to every number you want. The port 1194 is the defaut port and It’s easy for an expert disccover your VPN connection and bypass it, so change It!

For the connection to the VPN you can use the public IP of your Raspberry Pi on DNS name, to create DNS name you have to pay so for a completely free project I use the public IP. If you choose this option avery time the public IP change you have to reconfigure all your device connected to the VPN.

After the installation reboot your Raspberry Pi and start to add device on you VPN server, put in the command line:

pivpn add

Choose the name of the Client and set the password the Pi created a file called clientname.ovpn in the folder /home/pi/ovpns, we need this file in our device so share the folder with command:

1. cd ovpns
2. python -m SimpleHTTPServer 8080

The last step is routing your Raspberry Pi, the routing method is different by every modem so I give you a link that show you how to do port forwarding on your router here.

That’s what I do in my case:

Now we can download the file in the ovpns folder in our device only type the Raspberry Pi IP address in the search bar on our browser. Download the file that you have created on your device and add it in OpenVPN software, after that you have succesfully created your private VPN completely free!

I hope you like this project, see you soon and be creative!