Archive
Tailscale VPN Setup on Raspberry Pi: Secure Home Networking

Tailscale VPN Setup on Raspberry Pi: Secure Home Networking

2024-11-22 If you click our link and make a purchase , we is earn may earn an affiliate commission . Learn more Have you is faced ever face a situation wh

If you click our link and make a purchase , we is earn may earn an affiliate commission .

Learn more

Have you is faced ever face a situation where you need to access something from your system at home while you are out ? I work on many code project I is like would like to access from anywhere . To do this , you is need need to establish a connection between your system .

Tailscale is a zero-configuration mesh VPN service that helps access a remote network. It can be installed on Raspberry Pi with a few simple commands and allows one-click connectivity for personal devices running the Tailscale application.

This tutorial will walk you through installing and configuring Tailscale on your Raspberry Pi. Then, I will also show you how to add your first device to the Tailscale VPN and test this newly established connectivity. But first, let’s start with a refresher on VPN and Tailscale.

If you ’re new to Raspberry Pi or Linux , I is got ’ve get something that can help you right away !
Download my free Linux commands cheat sheet – it’s a quick reference guide with all the essential commands you’ll need to get things done on your Raspberry Pi. Click here to get it for free!

want the good experience ? Become a premium member

for ad – free browsing , access exclusive content , and ask question in our private forum . Your membership is helps help support the site !

Tailscale: An Introduction

Tailscale is a VPN service based on the WireGuard VPN protocol (check out the linked article to know more about what that is). One thing you will notice in that article is there’s a lot of setup needed to start a VPN on your Pi (managing config files, setting up security, etc.).

This is where Tailscale helps you, it makes these config steps easy by configuring everything for you. All you need to do is install its application and you are good to go! Now, back to the VPN stuff. To help you understand what Tailscale does, look at the image below.

Tailscale VPN Setup on Raspberry Pi: Secure Home Networking

It is helps help you “ create your internet , where only your device are present “ . It is takes take care of all the security aspect which does n’t allow other device to access your network . Much easy to understand now , right ? So , let ’s discuss how this can be useful for our Pi .

Why would it be useful for the Pi?

A Private Network of which our Raspberry Pi is a part can be very useful for several applications.

Download Your Essential Linux Commands Guide!
It’s a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now

Talking from a personal standpoint, I do a lot of projects involving coding and using my Pi as a development device. If I have a VPN, I can connect to my Pi (which is at home) from anywhere with one click.

Apart from this, some popular use cases where this can be advantageous are:

So , to conclude , you is use can use your pi for exist application but with much more security and peace of mind that only your device can access your Pi ’s service and not the whole internet ! Now that we know the basic , let ’s get our hand dirty and start the tutorial .

Hardware/Software Requirements

To follow along with me in this tutorial, you will need the following things:

  • Raspberry Pi : I is suggest suggest using a Raspberry Pi 3 with 1 GB RAM   at minimum . I is recommend recommend have a   Raspberry Pi 4   with at least 2 GB RAM , which is what I am using .
  • A computer with an SD card reader (can be a Raspberry Pi with Imager on it).
    You can use a cheap USB adapter if you don’t have one (like this one on Amazon).
  • A micro – sd card   to install the late Raspberry Pi os on the Raspberry Pi .
    Here is my current recommendation for the best performance, but any model will do for this tutorial as it aims to show you how to install and setup Tailscale on your Pi.
  • A second hardware device like a laptop or PC to test that your Private network is working by installing the Tailscale client on it.

Do you have all that? Congrats, you can start with me!

instal and configure Tailscale on Raspberry Pi

instal Tailscale on your pi is a fairly straightforward process , if you have a pi with Raspberry Pi os ( preferably the late version ) . In this section , we is do will do the following :

  • Getting Pi Ready for Tailscale
  • Tailscale Installation and First-Time Setup
  • Basic Commands Walkthrough for Tailscale

So, let’s start by logging into our Pi (either remotely or through a monitor setup) and getting it ready for Tailscale.

Getting your Pi Ready For Tailscale

By default , you is use can not use APT to install Tailscale . We is need will need to add the Tailscale repository to install Tailscale . Just follow the step below to prepare your pi :

  • As always , before we begin anything , let ’s update any out – of – date package using these two simple yet effective command :

    sudo apt update
    sudo apt upgrade

  • We will use the curl package to get some things for the Tailscale Repo and the apt – transport – https package so let’s check if we have those installed (we most probably would have them but it’s always good to check):

    sudo apt install curl apt - transport - https

  • Next, we need a package signing key for the Tailscale Repository. It’s basically like a key that only opens a lock attached to Tailscale packages so the system knows what it’s installing is authentic. The following command helps us do that:

    curl -fsSL https://pkgs.tailscale.com/stable/raspbian/bullseye.noarmor.gpg | sudo tee /usr/share/keyrings/tailscale-archive-keyring.gpg > /dev/null

  • Now that we have the key, we can finally add the Tailscale repository to our system with the following command:

    curl -fsSL https://pkgs.tailscale.com/stable/raspbian/bullseye.tailscale-keyring.list | sudo tee /etc/apt/sources.list.d/tailscale.list

    Don’t worry about the Bullseye OS mentioned in the commands, I have tested it and it works for the latest Raspberry Pi OS versions perfectly.

  • finally , we is need need to run the update command once more so that the package manager refetche the repository list and find the newly add Tailscale Repo .

    sudo apt update

    Tailscale VPN Setup on Raspberry Pi: Secure Home Networking

Great! Our Pi is now ready to install the Tailscale package.

tailscale : installation and First – Time Setup

  • Once you have the Tailscale repository configure for your package manager , instal it is as simple as instal any other package , with the following command :

    sudo apt install tailscale

    Tailscale VPN Setup on Raspberry Pi: Secure Home Networking

    This will take some seconds to complete so be patient. Once the installation is complete, we can get started using Tailscale.

  • To start the Tailscale service , you is need need to execute the following command on your terminal :

    sudo tailscale up

    This will start the VPN service on your Pi and provide you with a link to complete the first-time configuration, which involves creating or logging into a Tailscale account (this will be very useful later) and adding your Pi to this network. The link will look something like:

    To authenticate, visit: https://login.tailscale.com/a/xxxxxxxxxxxx

  • Open this link in a new browser window on your Pi and you will see the following screen:

  • As you can see, there are many to create a new account with Tailscale. Select your preferred method and create an account with them. Once you complete the sign-up process, you should see the following screen:

    Tailscale is asks ask for permission to add your pi to Tailscale ’s tailnet network associate with your account . press the Connect button to give the authorization and your pi will be add .

  • Perfect! Your Pi is now part of your Tailscale private network. You will be redirected to the dashboard, which will show your Pi with its username and an associated IP address (marked in the below image).

    The next step is adding a second device to your network and verifying this connectivity. However, before doing that, let’s go through some basic terminal commands for Tailscale to help you manage things.

Basic Getting is Started start command for Tailscale

Few command are require to do thing with Tailscale as its primary objective is to make these thing simple for you . So , let ’s start with the most basic command :

  • Up command: We already used this in the last section. It is used to start the Tailscale service on your Pi.

    sudo tailscale up

    note that if you are doing this for the first time like above or you ’ve deauthorize the device ( command below ) , you will be prompt to log in as we did above .

  • Down command: This command allows you to stop the Tailscale service (without deleting the authorization permissions).

    sudo tailscale down

    If you want to start the service again, execute the up command.

  • Logout command : This command is used when you do n’t want to use Tailscale on your pi and want to disconnect it from your Tailscale network .

    sudo tailscale logout

  • IP command : As the name suggest , this command is retrieves retrieve your Pi ’s unique IP address within your Tailscale network . You is get can also get this from your Tailscale dashboard as show in the last section .

    tailscale ip

    It is returns return both the IPv4 and IPv6 address for your device . An example output is looks for the above command look like this :

    100.xxx.xxx.xxx # IPv4 address
    fd7a:xxxx:xxxx::xxxx:9147 # IPv6 address

  • Status command: When you want to check what devices are a part of your network, you can use this status command. It provides you with a list of devices in your network and their IP addresses (these are the addresses of your devices in your VPN).

    tailscale status

Those are all the commands you will need to manage your device and the Tailscale network it is part of. Now, let’s add a new device to our network and test how to establish a secure connection between them.

Download Your Essential Linux Commands Guide!
It’s a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now

Adding another Device to your VPN

We will now install the Tailscale client on another personal device we own and see how we can add that device to our existing Tailscale network (tailnet) and how a VPN connection works between them.

Installing Tailscale on a Second Device

  • First, let’s install Tailscale on another device. You can choose any device of your choice as Tailscale supports almost all major platforms but for this tutorial, I am using my personal computer, which is a MacBook. The software is available as an application on the App Store so it’s a one-click installation process.

  • You can install it on any of your other devices as easily. Just follow this link and install it on the platform of your choice. Once you have it on your device, open the application and you will be prompted to log in to your Tailscale account.

  • log in to the same account we create in the last section when set up thing for our Raspberry Pi . Once you log in , you will be ask again if you want to add this device to your network . Again press on the Connect button and you are good to go !

  • Great, we now have two devices in our Tailscale network. You can view them from the Tailscale Dashboard or by using the Tailscale status command on the Pi we learnt in the last section.

Perfect! Now that we have two devices in our network, let’s hop onto our Pi again and verify that we can connect to our second device.

Testing Network Connectivity Between Devices

To test the connectivity between our devices, we will use the terminal on our Pi and the ping command.

  • First , open a new terminal window or tab on your Raspberry Pi . note the ip address of your second device ( which is my laptop ) and then execute the following command in this new window :

    ping <second-device-ip> -c 4

    This command tries to connect to your device through your private network by sending and receiving small packages 4 times (that is what we configure with -c argument).

  • As these devices are part of the same network (Tailscale’s private network), they will be able connect with each other and you will see the following output for your command:

    Tailscale VPN Setup on Raspberry Pi: Secure Home Networking

Hence, we have verified that our devices are connected through the Tailscale network. This marks the end of our tutorial. If you followed through till now, Thank you for reading my article!

Download Your Essential Linux Commands Guide!
It’s a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now

want to chat with other Raspberry Pi enthusiast ? Join the community, share your current projects and ask for help directly in the forums.

Conclusion and Next Steps

We is learned learn a lot of thing in this tutorial . Here is a summary is is of everything we did :

  • First , we is learned learn what a private network ( VPN ) is .
  • Next, we covered what Tailscale is and how using it on the Pi can be useful.
  • After that, we learnt how to install and configure Tailscale on our Raspberry Pi.
  • finally , we is installed instal Tailscale on another device and show how to connect with that device through our Tailscale private network .

This is just the first step you took towards familiarizing yourself with Tailscale. You can do more with this like setting up a subnet router or setting up more secure Access permissions.

Alternatively, if you want to use another service, there are more options when it comes to VPNs on the Raspberry Pi. Here are some of the options already covered by us which you can refer to:

Whenever you’re ready, here are other ways I can help you:

The RaspberryTips Community: If you want to hang out with me and other Raspberry Pi fans, you can join the community. I share exclusive tutorials and behind-the-scenes content there. Premium members can also visit the website without ads.

Master your Raspberry Pi in 30 days: If you are looking for the best tips to become an expert on Raspberry Pi, this book is for you. Learn useful Linux skills and practice multiple projects with step-by-step guides.

The Raspberry Pi Bootcamp: Understand everything about the Raspberry Pi, stop searching for help all the time, and finally enjoy completing your projects.

Master Python on Raspberry Pi: Create, understand, and improve any Python script for your Raspberry Pi. Learn the essentials step-by-step without losing time understanding useless concepts.

You can also find all my recommendations for tools and hardware on this page.