This article will guide you through installing Tailscale on a Raspberry Pi, turning your Pi into a secure, accessible device from anywhere.
What is Tailscale?
Tailscale creates a secure network between your devices, no matter where they are. It still uses WireGuard as its underlying protocol to build a mesh VPN, giving each device a unique IP address within your Tailscale network. This means you can access your Raspberry Pi, its services, and any attached devices as if they were all on the same local network, even when you're thousands of miles away.
Why use Tailscale on a Raspberry Pi?
A Raspberry Pi is a versatile mini-computer perfect for self-hosting applications, running home automation, or acting as a personal server. By adding Tailscale, you unlock even more possibilities:
- Remote access: Securely access your Pi's SSH, VNC, or web interfaces from anywhere without complex firewall configurations or manual port forwarding.
- Self-hosted services: Host your own personal cloud, private media server, or smart home hub on your Pi and access it securely on the go.
- IoT management: Securely connect and manage other IoT devices on your home network through your Pi.
- Ad blocking: Combine Tailscale with Pi-hole on your Raspberry Pi to get ad-blocking capabilities across all your Tailscale devices, even when you're away from home.
Prerequisites
Before we begin, ensure you have the following:
- A Raspberry Pi: Raspberry Pi 3, 4, or 5 are recommended for better performance. This guide assumes you are running Raspberry Pi OS (formerly Raspbian), either the Lite (headless) or Desktop version.
- An active internet connection: Necessary for downloading packages.
- SSH access or direct keyboard/monitor access: To execute commands on your Pi.
Installation Steps
The installation process is pretty straightforward.
1. Install the apt-transport-https plugin
First of all, install the necessary apt-transport-https plugin:
sudo apt install apt-transport-https
2. Add the Tailscale repository
Then, add Tailscale's package signing key and repository to your Raspberry Pi's package list. This ensures you get the latest version of Tailscale directly from the source.
curl -fsSL https://pkgs.tailscale.com/stable/raspbian/buster.gpg | sudo apt-key add -
curl -fsSL https://pkgs.tailscale.com/stable/raspbian/buster.list | sudo tee /etc/apt/sources.list.d/tailscale.list
Note: If you are using a newer version of Raspberry Pi OS (e.g., Bullseye or Bookworm), replace buster with bullseye or bookworm respectively in the commands above. You can check your OS version with cat /etc/os-release.
2. Update and install Tailscale
Now, update your package lists and install Tailscale:
sudo apt update
sudo apt install tailscale
3. Authenticate your Raspberry Pi
Once installed, you need to authenticate your Raspberry Pi with your Tailscale account. This will link your Pi to your Tailscale network.
sudo tailscale up
This command will output a URL. Copy this URL and paste it into your web browser. You'll be prompted to log in to your Tailscale account and authorize the device. After successful authorization, your Raspberry Pi will appear in your Tailscale admin console, and it will be assigned an IP address within your Tailscale network (e.g., 100.x.y.z).
4. Verify the installation
To verify that Tailscale is running and connected, you can use the following command:
tailscale status
This will show you the status of your Tailscale connection, including its Tailscale IP address and which user it's connected as.
What's next?
Now that Tailscale is running on your Raspberry Pi, you can start exploring its capabilities:
- Access your Pi: From any other device on your Tailscale network, you can now access your Raspberry Pi using its Tailscale IP address or its hostname (e.g., ssh pi@my-raspberry-pi).
- Subnet routers: Configure your Raspberry Pi as a subnet router to allow other devices on your Tailscale network to access your local home network, even if they aren't running Tailscale themselves.
- Exit nodes: Use your Raspberry Pi as an exit node to route all your internet traffic through your home network, giving you secure access to your home IP address from anywhere.
- Share your Pi: Share access to your Raspberry Pi with friends or family by inviting them to your Tailscale network.
Enjoy the newfound security and accessibility of your Raspberry Pi with Tailscale!