Introduction
In an age where privacy concerns and cyber threats abound, securing your home network becomes not just a recommendation but a necessity. One excellent way to secure your connection is through a VPN (Virtual Private Network). While there are many third-party VPN services, setting up your own VPN server provides an added layer of security and customisation. This is where PiVPN comes into play.
PiVPN is a simple and convenient solution for setting up a VPN on a Raspberry Pi. By the end of this comprehensive guide, you’ll have a secure, private network that you can access from anywhere in the world.
Thanks to Teklan VPN
A big thank you to Teklan VPN for providing us with a Raspberry pi and some guidance. Their support has made it possible for us to create and share this guide with you.
We appreciate Teklan VPN’s contribution to our project – Give them a look if you need a reliable VPN service with worldwide locations! No silly or predatory pricing, Just honest and fair plans to suit all budgets!
Pre-requisites
Hardware
- Raspberry Pi: A Raspberry Pi 3 or newer is recommended.
- Micro SD Card: Minimum 8GB.
- Power Supply: Compatible with your Raspberry Pi model.
- Ethernet Cable: To ensure a stable connection.
Software
- Raspbian OS: Latest version.
- SSH Client: PuTTY for Windows, or Terminal for MacOS/Linux.
Networking Gear
- Router: With the ability to port forward.
- Internet Connection: Active and stable.
Step 1: Initial Setup
Assuming you’ve got your Raspberry Pi up and running with Raspbian, SSH into your Raspberry Pi to get started. If you have Pi-hole installed, PiVPN can run alongside it seamlessly.
SSH into Raspberry Pi
Open your SSH client and login using the Raspberry Pi’s IP address and default credentials (username: pi
, password: raspberry
).
Step 2: Installing PiVPN
Run the PiVPN Installation Script
curl -L https://install.pivpn.io | bash
A setup wizard will guide you through the installation process, including the following important steps:
- Choosing a User: Opt for
pi
or any other user you trust. - Selecting a VPN Type: You’ll get a choice between WireGuard and OpenVPN. WireGuard is recommended for its speed and simplicity.
- Port Configuration: Use the default or choose a custom port for the VPN.
- Static IP Address: Configure your static IP details.
- UPnP or Manual Port Forwarding: Choose based on your preference or router capabilities.
Step 3: Creating Profiles
After installation, you need to create profiles for each device that will connect to your VPN. To create a profile, run:
pivpn add
Follow the on-screen instructions to create a .ovpn
file. This file will be used to connect your device to the VPN.
Step 4: Port Forwarding
Navigate to your router’s admin console and locate the port forwarding section. Forward the port you selected during the PiVPN setup to the IP address of your Raspberry Pi.
Step 5: Connecting to PiVPN
Import the .ovpn
Profile
- On a computer, use an OpenVPN-compatible VPN client to import the
.ovpn
file. - On mobile, you might need a dedicated app like the official OpenVPN Connect app.
Connect to the VPN
Once imported, connect to the VPN using your client software. If everything is set up correctly, your client should establish a secure connection.
Step 6: Testing
To ensure your VPN is working, disconnect from your local network and try accessing your home network remotely via the VPN. If you can access devices and services on your home network, congratulations! Your VPN is up and running.
Conclusion
Setting up PiVPN may seem like an intimidating task, but hopefully, this guide has simplified the process for you. Not only do you now have a secure, encrypted connection, but you also have the privacy and flexibility to access your home network from anywhere in the world. Cheers to secure, private browsing!