Feb 19, 2026 by Zacharia Mansouri | 123 views
https://cylab.be/blog/486/how-to-turn-your-raspberry-pi-into-a-vpn-exit-node-with-tailscale
You want to access your home network securely from a coffee shop? Or perhaps you need to browse the internet from abroad as if you were sitting in your living room? In this guide, we will set up a Tailscale Exit Node on a Raspberry Pi. This routes your internet traffic through your home connection, providing privacy and access to local devices without the headache of port forwarding.
Tailscale is built entirely on top of WireGuard, a modern, open-source VPN protocol widely praised for its simplicity and blazing-fast performance. Unlike legacy protocols such as OpenVPN or IPsec, which can be code-heavy and slower to negotiate connections, WireGuard operates with a remarkably lightweight codebase and uses state-of-the-art cryptography. Tailscale essentially functions as a control plane for WireGuard: it handles the complex key exchange, mesh networking, and NAT traversal automatically, allowing you to benefit from WireGuard’s raw speed and security without the headache of manual configuration files. However, if you’re still curious about Wireguard (and you should!), here is a blogpost on Securing external traffic on a budget with Wireguard.
First, we need to install the Operating System. We will set this up “headless” (without a monitor), so we need to configure SSH access manually on the SD card.
Install the Raspberry Pi Imager on your computer:
sudo apt install rpi-imager
sudo rpi-imager
In the Imager settings:
Once the write is finished, re-insert the SD card into your computer so you can edit the files. Navigate to the bootfs partition (usually mounted at /media/<user>/bootfs, otherwise mount it).
To generate the encrypted password, run this in your terminal:
openssl passwd -5
Enter your desired password when prompted. Copy the output.
Inside the userconf file, format the text like this:
pi:your-encrypted-string-here
(Replace pi with your preferred username if desired).
Insert the SD card into the Raspberry Pi, connect the Ethernet cable, and power it on.
SSH into your Raspberry Pi. Once logged in, perform the following steps.
Update your system and run the installation script.
sudo apt update && sudo apt upgrade -y
curl -fsSL https://tailscale.com/install.sh | sh
The script will generate a login link. Copy/paste it into your browser to authenticate the Raspberry Pi.
For the Pi to act as a router (Exit Node), it needs to forward IP packets (and make it persistent across reboots).
echo "net.ipv4.ip_forward=1" | sudo tee -a /etc/sysctl.d/99-forwarding.conf
echo "net.ipv6.conf.all.forwarding=1" | sudo tee -a /etc/sysctl.d/99-forwarding.conf
sudo sysctl --system
Start Tailscale again, this time telling it to advertise itself as an exit node.
sudo tailscale up --advertise-exit-node
Ensure Tailscale starts automatically if the Pi reboots.
sudo systemctl enable tailscaled
Even though the Pi is advertising itself, you must approve it in the Tailscale dashboard.
Now, switch to the computer (Client) you want to connect to the VPN.
Note: The command below uses the automatic script, which detects your specific Linux version (Ubuntu, Debian, Fedora, etc.) to avoid repository errors. Also, installation steps may vary depending on your OS (Linux, MacOS, Windows…)
curl -fsSL https://tailscale.com/install.sh | sh
You need the Tailscale IP of your Raspberry Pi (this starts with 100.x.y.z, NOT 192.168.x.x). You can find this IP in the Admin Console next to the Pi.
Run the following command:
# Reset previous connections
sudo tailscale logout
# Connect using the specific exit node IP
sudo tailscale up --exit-node=<EXIT-NODE-IP> --exit-node-allow-lan-access
--exit-node: Routes your internet traffic through the Pi.--exit-node-allow-lan-access: Ensures you can still access local printers/servers on your current network while connected to the VPN.The script will also generate a login link. Copy/paste it into your browser to authenticate the Client.
Check if your public IP address has changed to match your home network’s IP:
curl ifconfig.me
How to see all the connected devices (from either the Server or the Client)? By fetching the status:
tailscale status # Needs 'tailscale up' to be run beforehand
How do I disconnect? To stop using the VPN and return to normal networking:
sudo tailscale down
How do I remove a device permanently?
Congratulations! Your Raspberry Pi is now a fully functional Tailscale Exit Node. Whether you are traveling or using untrusted public Wi-Fi, you can now browse the internet securely through your encrypted home connection.
This blog post is licensed under
CC BY-SA 4.0