VPN on Raspberry Pi: Set Up Your Own WireGuard Server at Home
How to run a VPN on a Raspberry Pi with PiVPN, wg-easy or Tailscale, what each option needs, and the commands to add phones and laptops as clients.
The most common way to run a VPN on a Raspberry Pi is to turn the Pi into a WireGuard server with PiVPN, a free install script that asks a few questions and then sets everything up for you. If you would rather click than type, wg-easy gives you a web dashboard in Docker, and Tailscale lets you reach your Pi from anywhere without opening ports on your router.
Below we cover what a Pi VPN is actually good for, how the three options compare, and step-by-step setup with PiVPN, which is still the route the project itself recommends for a Pi at home (as of November 2026).
What a Raspberry Pi VPN does (and doesn’t do)
A VPN running on a Pi at home is a tunnel back to your own house. When your phone connects to it from a café, your traffic travels encrypted to the Pi and then out through your home internet connection. That gives you two real benefits:
- Safer public Wi-Fi. The network you are sitting on only sees encrypted traffic to your home.
- Access to your home network. You can reach a NAS, a Home Assistant box or a Pi-hole as if you were on your sofa. PiVPN even added support for configuring Pi-hole v6 in its v4.9.0 release.
What it won’t do is make you anonymous or move you to another country. Websites see your home IP address, and your home internet provider still carries the traffic. If that is what you want, you need a commercial VPN service rather than a self-hosted one.
Your options compared
| Option | What it is | Best for | Things to know |
|---|---|---|---|
| PiVPN | Install script for WireGuard or OpenVPN | A classic home VPN server, managed from the command line | Maintained on a “best-effort basis”; needs incoming traffic to reach the Pi |
| wg-easy | WireGuard server plus a web admin UI, run in Docker | People who prefer a dashboard with QR codes and per-client stats | Requires Docker; the project suggests a reverse proxy if you expose the web UI to the internet |
| Tailscale | WireGuard-based private network across your devices | Reaching your Pi from anywhere without router changes | Core client code is BSD-3-Clause open source, but the service itself is run by Tailscale |
All three are built on WireGuard. If you want to understand the plumbing underneath, the official wireguard-tools package provides wg, the main utility for configuring tunnels, and wg-quick, a script that brings up an interface from a config file.
A word on PiVPN’s status
PiVPN’s history is a little bumpy, so it’s worth knowing before you rely on it. In April 2024 the maintainer published v4.6.0, calling it “the final official release” and saying the repositories would be archived. About a week later, v4.6.1 walked that back: PiVPN “will continue to be maintained on a best-effort basis,” mainly updating for new distribution releases, with large features unlikely unless someone sends a pull request.
Since then the release history shows steady small updates, including:
- v4.7.0 (June 2024): WireGuard support in containers
- v4.10.0 (March 2025): removed support for end-of-life operating systems
- v4.10.1 (August 2025): fixed Debian 13 (trixie) support
- v4.11.0 (August 2025): raised the minimum TLS version and updated EasyRSA for OpenVPN
- v4.11.1 (September 2025): a module path fix
The latest release we could confirm is v4.11.1. Check the releases page before installing, as this may have changed.
How to set up a VPN on a Raspberry Pi with PiVPN
The PiVPN README recommends Raspberry Pi OS Lite on a Pi at home. Most Debian- and Ubuntu-based systems also work.
Before you start
- Give the Pi a fixed address on your network (a DHCP reservation in your router works well), so port forwarding keeps pointing at the right device.
- Know your public IP address or have a hostname that points to it. You’ll be asked for it during setup.
- Update the system with
sudo apt update && sudo apt full-upgrade.
Install
-
Run the official installer from the PiVPN project:
curl -L https://install.pivpn.io | bashIf you would rather read the script before running it, the README also documents cloning the repository and running
auto_install/install.sh. -
Work through the prompts. According to the PiVPN docs, the installer updates packages, installs WireGuard (the default) or OpenVPN, and asks about the port, protocol and DNS server for clients. Pressing Enter through the defaults should give you a working setup.
-
Let it finish. The script turns on traffic forwarding and opens the VPN port in the Pi’s firewall. A reboot afterwards is optional.
If you choose OpenVPN with RSA certificates, be patient: the docs note that generating 2048-bit Diffie-Hellman parameters took around 40 minutes on an old Pi Model B+. WireGuard avoids that wait.
Open the port on your router
Your router needs to send incoming VPN traffic to the Pi. In the router’s admin page, forward the UDP port you chose during setup to the Pi’s local IP address. The PiVPN WireGuard docs use port 51820 in their example configs. Router menus differ a lot, so look for “port forwarding” or “virtual server” in your model’s manual.
If your public IP address changes later, PiVPN’s docs explain that you update pivpnHOST in setupVars.conf and then edit the Endpoint line in any client configs you already made.
Add your devices
Everything is managed with the pivpn command. The main ones for WireGuard, from the PiVPN WireGuard docs:
| Command | What it does |
|---|---|
pivpn add | Create a profile for a new device |
pivpn -qr | Show a profile as a QR code for the mobile app |
pivpn list | List all clients |
pivpn clients | Show connected clients |
pivpn remove | Remove a client |
pivpn backup | Back up configs and profiles |
pivpn update | Update the PiVPN scripts |
pivpn debug | Start a debugging session |
Then connect each device:
- Phone (Android or iOS): install the official WireGuard app and scan the code from
pivpn -qr. If the QR code looks garbled in your terminal, the docs suggestpivpn -qr -a256. - Windows or Mac: copy the
.conffile to the computer, import it into the WireGuard app and activate the tunnel. - Linux: move the config to
/etc/wireguard/and usewg-quick upandwg-quick down, or import it into NetworkManager withnmcli.
Use one profile per device. That way you can remove a lost phone without touching anything else.
If connections keep dropping
Some networks with aggressive NAT close idle connections. PiVPN’s docs recommend PersistentKeepalive = 25 for this; it is off by default and you can turn it on for new profiles with pivpnPERSISTENTKEEPALIVE=25 in setupVars.conf. For anything else, pivpn debug collects diagnostics, and the project prefers support questions in its GitHub Discussions.
When to choose wg-easy or Tailscale instead
wg-easy suits you if you already run Docker on your Pi and want a browser-based way to create, enable, disable and delete clients, view QR codes and see traffic charts. It also offers optional two-factor login and OAuth or OIDC sign-in. The project recommends Docker Compose as the easiest install. Its GitHub page doesn’t list supported CPU architectures, so check its documentation for ARM images before you commit.
Tailscale is the better pick when you can’t or don’t want to forward ports, for example behind carrier-grade NAT or a router you don’t control. It describes itself as “private WireGuard networks made easy,” and its daemon runs on Linux, so the Pi just becomes another device on your private network. The trade-off is that you depend on Tailscale’s hosted service rather than running everything yourself.
Our take
For a straightforward home VPN on a Pi, PiVPN with WireGuard is still the quickest path from a fresh SD card to a working tunnel, as long as you’re comfortable with its best-effort maintenance and keep the Pi’s packages updated. If you want a dashboard, use wg-easy. If port forwarding is a non-starter, use Tailscale. Whichever you choose, keep in mind that a home VPN protects your connection and gives you access to your home network. It does not hide who you are from the sites you visit.
Free apps worth trying
SponsoredSponsored links. Installing through them can earn us a commission, at no cost to you. Apps are free to download; some offer optional in-app purchases.
Frequently asked questions
Is PiVPN still maintained in 2026? +
Partly. The lead maintainer called v4.6.0 the final release in April 2024, then reversed course a week later and said PiVPN would continue on a best-effort basis. Releases kept coming through 2025, including Debian 13 (trixie) fixes, but large new features are unlikely unless someone contributes them.
Will a Raspberry Pi VPN hide my traffic from websites or let me change country? +
Not really. A VPN server at home sends your traffic out through your home internet connection, so websites see your home IP address. It protects you on untrusted Wi-Fi and gives you access to your home network, but it is not a substitute for a commercial VPN if you want a different location.
Should I pick WireGuard or OpenVPN in PiVPN? +
WireGuard is the installer's default and the simpler choice for most people, and the official WireGuard apps can import a profile by scanning a QR code. OpenVPN is still offered if you have a client or network that only supports it; note that generating RSA parameters for OpenVPN can take a long time on older Pi models.
Do I need port forwarding? +
For a classic self-hosted server like PiVPN or wg-easy, your router has to let incoming VPN traffic reach the Pi, which usually means forwarding the VPN port. Mesh tools like Tailscale are designed for situations where you would rather not open ports, though you then rely on Tailscale's coordination service.
Sources
- PiVPN README (pivpn/pivpn on GitHub) (github.com)
- PiVPN releases (v4.6.0 to v4.11.1) (github.com)
- PiVPN docs: installation overview (github.com)
- PiVPN docs: WireGuard (github.com)
- wg-easy on GitHub (github.com)
- Tailscale on GitHub (github.com)
- wireguard-tools README (raw.githubusercontent.com)