Categories
Uncategorized

VPN

How to turn a Raspberry Pi into a VPN server

With all that preliminary stuff out of the way, it is time to see how to get this project built. But before we start, let’s be clear. This is not an attempt to give you detailed instructions to complete the project. We’re not going to be telling you to open a command prompt and enter commands like this:

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

We’re not hard-core Raspberry Pi people. We don’t know all the ins and outs of these little devices well enough to do so safely. Besides, there is no way we’re going to be able to keep this article up to date with all the new Linux updates and Pi versions that keep popping up.

Instead, we’re going to give you all the high-level steps, and leave it up to you (or other Pi experts) to know exactly how to implement those steps on this version of the Pi, running this version of Linux, and so on. So let’s get started:

  1. Install PiVPN on your Raspberry Pi. Hint: The example command from before, “curl -L https://install.pivpn.io | bash” could come in handy here.
  2. Run PiVPN.
  3. Tell PiVPN whether you set up a static address (a DHCP reservation).
  4. Choose between OpenVPN or WireGuard.
  5. Select a communication protocol. UDP is recommended for OpenVPN and required for WireGuard.
  6. Set the VPN port. The default OpenVPN port is 1194. The default WireGuard port is 51820.
  7. Set the DNS provider. If you set up a dynamic DNS you will enter that here. If not, you will need to specify a DNS service to use. An internet search for the phrase “secure DNS providers” will give you lots of options.
  8. If using OpenVPN, select the Enable OpenVPN 2.5 features option unless some Apps you’re using don’t support them.
  9. If PiVPN presents them, follow the steps for creating a security certificate and configuration file.
  10. Using the instructions for your router, forward the VPN port to the internal IP address of your Raspberry Pi VPN server. Remember, this is port 1194 for OpenVPN and 51820 for WireGuard.

Your Raspberry Pi VPN server should now be ready to go.

Adding a VPN client

While the Raspberry Pi is now set to function as a VPN server, you still need a VPN client (VPN app) to connect to the server.

OpenVPN provides OpenVPN Connect clients you can install on whichever devices you plan to connect to your Pi VPN server.

WireGuard also provides clients for the leading operating systems.

Leave a Reply