Setting up your own VPN server sounds complicated and time-consuming. It was at first, especially when you are trying to do this from China and half of the internet related to VPN is not available. Fortunately, with hassle-free Raspberry Pi VPN – piVPN you can get it up and running in a moment. The process is easy enough but I will walk you through to make sure you do it right. If you wonder what kind of performance you should expect from the Raspberry Pi Zero check this article out.
Hassle free Raspberry Pi VPN VPN – piVPN server on Raspberry Pi Zero
The process is very simple, as the installer as very easy to follow steps with little variations. Before you start, head to www.no-ip.com and get a DNS. It’s easier than remembering your IP. If you wonder if you should splash out on the best Raspberry Pi board, read this article about VPN speeds across the boards. You will need it for the installation. You will also need:
- A way to download a file from Raspberry Pi to PC or phone (I use Notepad++ FTP plugin or WINscp )
- Open VPN app/software on your client device
- 15 min of spare time to wait for the key generation
Check the server’s IP, you can do so by visiting Google and typing my IP, or type:
dig TXT +short o-o.myaddr.l.google.com @ns1.google.com | awk -F'"' '{ print $2}'
in the console of your Raspberry Pi. You will also need access to your router, as we will have to forward a port. Before you start with all of this make sure your Raspberry Pi has a static IP assigned. Run:
ifconfig
to check what interface handles your internet connection and follow the steps from here to make it permanent.
You are ready to roll. Update your Raspberry PI and run:
curl -L https://install.pivpn.io | bash
This is not the safest way to get things done on the Raspberry Pi, but you can trust this installer. To navigate the menus use arrows/TAB to change the cursor position, SPACE to select an option and ENTER to continue. If you don’t have a static IP I found a fairly simple guide from noip.com that shows you how to update your IP every X minutes. The link is here.
piVPN installation
Take the time reading the info, as going back is not always possible. I will assume you have completed the static IP part already so we could move on.
You should see the current IP address listed. Check if this is the same one you have configured previously and confirm. You can change it at this point as well. Note the Gateway address. We will use it later. Unless you have multiple users you should see only one option. Use arrows and SPACE to select the correct user.
Because it is a VPN server we want to make sure we don’t have to attend it. It’s for the best if you leave the piVPN to apply the settings automatically.
UDP vs TPC -extra security over speed – UDP, as suggested it the better option.
Use a different than the default, port number. Ie 1501 and make a note of this. Confirm the chosen port. Now key encryption. 2048-bit will take about 20 min, and it’s the standard security. For your safety pick the 2048-bit encryption and go get a brew, or watch another video from my playlist.
Once the encryption is done, it’s time to fill in the DNS (or IP address) you can use the default one but I strongly recommend the DNS.
Time to provide the server with custom DNS – we are going to use our router’s IP: 192.168.1.1 (The Gateway you have noted before).
The system is ready for the reboot. You will be able to add the users.
Use piVPN -h for help file and run
pivpn -a
to add a new user. You will be asked to add a password as well.
Everything is done on the server side. Time to download the openvpn config file to a client.
You can do this by using FTP client of the Notepad++:
Save it somewhere and open the openVPN client of your choice. For the PC open up the OpenVPN and import the profile, the same goes for the android app. Once you have done this, you are ready to go.
Your VPN should be up and running now. It may not protect your privacy while you are home, but will deal with IP related bans when you are visiting places. As you can see, creating your own Raspberry Pi VPN server is easy, and hassle-free!