Saturday, September 28, 2019

Raspberry Pi 4 as a VPN Server

I've bought Raspberry Pi 4 to use it as a DaaS (Desktop as a Service). I've needed a VPN server to securely connect to when I am traveling. I've needed a Cloud Server to replace Dropbox to have unlimited space. I've needed a NAS (Network-attached storage) to share files among mu laptops and computers. I've also needed a Music Player Server to manage my music files and serve as a source for my amplifier. I've also needed a media player like Apple TV to play my movies, youtube etc.

In summary Raspberry Pi as:
1. Cloud server
2. VPN server (this post)
3. NAS
4. Music server
5. Media Player




To be able to do all of the above, I think it is better to keep the original Raspbian distribution.

Lots of limitations can be imposed on internet access that makes it impossible to use VPN. (Warning You Are Responsible For How You Use VPN) Organizations can close ports that are usually used for VPN access, therefore I've decided to use port 80 which is for webpages. If port 80 is not accessible it means that the internet access is down! Another limitation can be the protocol that your VPN app uses over port 80. The protocol that is used for webpage access is TCP so I've decided to use that. All in all, with these VPN settings from the admin perspective you're accessing a webpage. I have used dynamic DNS can be used for accessing your VPN sever globally. Remember to do Port Forwarding from your router to Raspberry Pi.


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

Add user:
pivpn add

Edit USER.ovpn to have your Dynamic DNS address
Send the USER.ovpn to the user.
Open USER.ovpn using OpenVPN app