Installing Tailscale to the Raspberry Pi

In this tutorial, we will be showing you how to install Tailscale on the Raspberry Pi.

Raspberry Pi Tailscale

Tailscale is software that allows you to set up a zero-configuration VPN on your Raspberry Pi in minutes.

Designed to remove the complexity of setting up your own VPN, Tailscale doesn’t even require you to open any ports in your firewall for it to operate.

Being built on top of Wireguard also has its benefits. Tailscale gives you a fast, secure, and private connection to your device.

Best of all, Tailscale comes with a great free tier for personal use. On this free tier, you can connect up to 20 different devices within the same VPN.

This software is an excellent solution for those running a headless Raspberry Pi and wanting to get easy remote access.

Equipment

Below is the list of equipment we used when installing and setting up Tailscale on the Raspberry Pi.

Recommended

Optional

This tutorial was tested on a Raspberry Pi 400 using the latest version of Raspberry Pi OS Bullseye.

Preparing your Raspberry Pi for Tailscale

This section will get you to prepare your Raspberry Pi’s operating system so that we can install and run Tailscale.

1. Before we begin, let us update the package list and any out-of-date packages.

You can perform these updates by using the following two commands.

sudo apt update
sudo apt upgrade

2. Our next step is to install any packages we will need to complete the installation of Tailscale. Luckily there are only two that we have to worry about.

Use the following command to install both “lsb-release” and “curl“.

sudo apt install lsb-release curl
  • lsb-release – This package allows us to easily grab information about the system such, as the OS release name.
  • curl – We will use curl to download the Tailscale GPG key to our Raspberry Pi.

3. Once the package is installed, we need to grab the GPG key for the Tailscale repository by using the command below.

The GPG key is what helps your Raspberry Pi identify the package it is downloading is authentic

curl -L https://pkgs.tailscale.com/stable/raspbian/$(lsb_release -cs).noarmor.gpg | sudo tee /usr/share/keyrings/tailscale-archive-keyring.gpg >/dev/null

Using “$(lsb_release -cs)” within this command, we can insert the correct operating system code name.

4. Once the PG key has been saved to your system, we can finally add the Tailscale repository.

To insert the link to the Tailscale repository on your Raspberry Pi, you can use the following command.

echo "deb [signed-by=/usr/share/keyrings/tailscale-archive-keyring.gpg] https://pkgs.tailscale.com/stable/raspbian $(lsb_release -cs) main" | sudo tee  /etc/apt/sources.list.d/tailscale.list

The above command will create a new file within the “sources.list.d” directory called “tailscale.list“. Within this file is a link to the Tailscale repository that the package manager will read during an update.

5. For your system to be aware of the Tailscale repository, we will need to perform another package list update.

Update the package list by using the command below in the terminal.

sudo apt update

Installing and Running Tailscale on the Raspberry Pi

Now that we have added the Tailscale repository to our Raspberry Pi, we can proceed to install the software.

1. At this point, all we need to do to install Tailscale is run the following command.

This command will install this software from the repository that we added in the previous section.

sudo apt install tailscale

2. To start up the Tailscale network on our Raspberry Pi, you will need to use the following command on your device.

This command will start the process of connecting to Tailscale and setting up your VPN. You will need to authenticate yourself with Tailscale by using one of three

sudo tailscale up

3. After running the above command, you will see a message like the one below.

To start the process of authenticating yourself with Tailscale, you will need to go to the URL in your favorite web browser.

To authenticate, visit:

        https://login.tailscale.com/a/XXXXXXXXXXXX

4. At this point, you will need to log in to the Tailscale website to authenticate your device.

You will need to sign in with either a Google, Microsoft, or GitHub account. If you have never used Tailscale, an account will be created during sign-in.

Log to Tailscale

5. After logging in, you will see the following message displayed within your web browser.

Authorization Successful

Additionally, within the console on your Raspberry Pi, you should now see the message below in the terminal. This indicates that your Pi is now connected to Tailscale.

Success.

6. If this is the first time you have used Tailscale, you will need to add it to another device to form a network.

In our case, we proceeded to install Tailscale on our Windows laptop so we could access our device remotely.

Add Additional Device to Tailscale Network

7. Once you have Tailscale installed on two devices, you should see the screen below in the web browser.

Tailscale provides you with a command (1.) that you can use to verify that Tailscale is working on your Raspberry Pi. This command will send a ping to the specified Tailscale IP address.

If everything works fine, you can click the “Success, it works!” button (2.).

Ping Raspberry Pi from Tailscale

8. You will now get a list of guides that you can use to improve your configuration of Tailscale on the Raspberry Pi.

To proceed to the admin console, click the “Go to the admin console” button.

Change to Admin Console

9. The final screen you will be greeted with is the dashboard of Tailscale.

Using this screen, you can manage all of the machines that are a part of your Tailscale network. You can also manage things such as access controls and other settings.

Raspberry Pi Tailscale Admin Console

Using Tailscale on your Raspberry Pi from the Terminal

This section will cover a couple of commands you can use within the terminal. These commands will get additional information about Tailscale running on the Raspberry Pi.

Retrieving the IP assigned to your Raspberry Pi by Tailscale

You can use the Tailscale command line tool to retrieve the IP address assigned to your Raspberry Pi.

While you can also get this IP from the Tailscale dashboard, it is sometimes faster to run the following command.

tailscale ip

After running this command, you should get a list of both IP addresses assigned to your device. One is an IPv4 address the other is IPv6.

100.XX.XXX.XXX
fd7a:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:8079

Getting the Status of Tailscale

By using the following command in the terminal, you can get the status of Tailscale on your Raspberry Pi.

This command will return the IP address of your Raspberry Pi and all other devices that are a member of the network.

tailscale status

Below is an example of the data returned using the above command.

100.XX.XXX.XXX  raspberrypi          pimylifeup@ linux   -
100.XXX.XX.XX   emmet-pc             pimylifeup@ windows idle, tx 1044 rx 540

Disabling Tailscale on the Raspberry Pi

You can use the following command if you want to temporarily disable the Tailscale network on your Raspberry Pi without de-authorizing the device.

This is useful when you want to disconnect temporarily from your private Tailscale network.

tailscale down

Enabling Tailscale

You will want to use the following command to bring the Tailscale network back up on your Raspberry Pi. This is the same command that you used to set up Tailscale in the first place

tailscale up

If your Raspberry Pi has become de-authorized from the network, you will be prompted to log in again.

De-Authorizing your Raspberry Pi from Tailscale

If you no longer want to use Tailscale on your Raspberry Pi, you will want to disconnect it from the network first.

You can perform this action by using the following command within the terminal.

tailscale logout

This command will bring the Tailscale network down and then expire the node key so it can’t be reused.

Conclusion

Hopefully, by this point, you will now understand how to install and use Tailscale on the Raspberry Pi.

Tailscale is a neat networking software that allows you to set up a VPN between your devices with little to no configuration.

Please comment below if you have had any issues with getting Tailscale to work on your device.

We have numerous other Raspberry Pi projects that are well worth checking out, including our guide on running Heimdall.

4 Comments

  1. Avatar for Bill Steiner
    Bill Steiner on

    Thanks Emmet, can you tell me how to completely uninstall Tailscale? I am going to install PiVPN using your instructions.
    Thanks again you provide great instructions and help, keep it up.

    1. Avatar for Emmet
      Emmet on
      Editor

      Hi Bill,

      You should be able to completely uninstall Tailscale from your system by using the following commands.

      1. First purge the tailscale package. Purging will uninstall and remove any configuration files belonging to Tailscale.

      sudo apt purge tailscale

      2. Next, remove the sources and GPG key that we added to remove the Tailscale repository.

      sudo rm /usr/share/keyrings/tailscale-archive-keyring.gpg
      sudo rm /etc/apt/sources.list.d/tailscale.list

      3. Finally run an update to make sure Tailscale is now cleared from your package list cache.

      sudo apt update

      Cheers,
      Emmet

  2. Avatar for Bill Steiner
    Bill Steiner on

    Great instructions, installed without any problems.
    I had setup my Pi using your instructions listed in “Build Your Own Raspberry Pi VPN Server” but was having port forwarding problems so I though this would solve that problem. When I was able to connect to the PiVPN device my laptop was able to browse the Pi’s network and connect to those network devices. When I connected using Tailscale I could not browse the Pi’s network. I was still on my laptops network and still had it’s ip address.
    Can you tell me how I can correct this?
    Thanks again.

    1. Avatar for Emmet
      Emmet on
      Editor

      Hi Bill,

      Sadly, Tailscale doesn’t quite work the way you want it to. Every device you want to connect to needs to have Tailscale installed as they need to be within the same virtual private network.

      So, while you can connect to your Raspberry Pi and the services running on it, you will need to install Tailscale again if you want to connect to your NAS for example.

      Cheers,
      Emmet

      Cheers,
      Emmet

Leave a Reply

Your email address will not be published. Required fields are marked *