Knowledgebase

Find frequently asked questions and setup guides by searching or by browsing the categories.

What Tailscale Is

Tailscale connects your devices into one private network, called a tailnet. Each device gets a private address, and devices talk to each other directly over WireGuard tunnels. A coordination service run by the vendor hands out keys and tells devices how to find each other; your traffic does not pass through it. When two devices cannot reach each other directly, traffic goes through the vendor's relay servers, still encrypted end to end.

If you do not want to depend on the vendor's coordination service, Headscale is an open-source, self-hosted control server that the Tailscale client can use instead.

Install Tailscale

The vendor publishes package repositories for Debian, Ubuntu, AlmaLinux, Rocky Linux, and other distributions, plus an install script that detects the distribution and adds the right repository. Download the script, read it, then run it:

curl -fsSL https://tailscale.com/install.sh -o tailscale-install.sh
less tailscale-install.sh
sudo sh tailscale-install.sh

You can also add the repository by hand from the vendor's download page and then run sudo apt install tailscale or sudo dnf install tailscale. Make sure the background service runs and starts at boot:

sudo systemctl enable --now tailscaled

Join the Server to Your Tailnet

sudo tailscale up

The command prints a login link. Open it in a browser on your own computer, sign in, and approve the server. For servers set up by a script, you can create an auth key in the admin console and pass it with --auth-key. Treat that key like a password: keep it out of shell history and out of Git.

Check the Connection

CommandWhat it shows
tailscale statusDevices in the tailnet and their addresses
tailscale ip -4This server's tailnet IPv4 address
tailscale ping web1Whether a path is direct or relayed
tailscale netcheckNAT type and nearest relay

Tailnet IPv4 addresses come from the 100.64.0.0/10 range, so they do not clash with the usual private ranges. With MagicDNS turned on in the admin console, devices are also reachable by their machine names.

Move SSH onto the Tailnet

This is the step that can lock you out, so follow the order:

  1. Keep your current SSH session open. Check that you can open the server console in your provider's control panel: it is your second way in if the tailnet ever fails.
  2. With Tailscale running on your own computer too, open a second terminal and connect with ssh user@your_server_ip, using the address that tailscale ip -4 printed.
  3. Allow SSH on the Tailscale interface. With UFW: sudo ufw allow in on tailscale0 to any port 22 proto tcp. With firewalld, put tailscale0 into a zone that allows the ssh service.
  4. Test again in a new session over the tailnet.
  5. Only then remove the public rule, for example sudo ufw delete allow OpenSSH or sudo ufw delete allow 22/tcp, whichever you added.

The rules are explained in how to set up the UFW firewall and firewalld basics.

Ports and the Firewall

Tailscale makes outbound connections and works through NAT, so in most setups no inbound port has to be opened for it. If outbound traffic is filtered, it needs TCP 443, UDP to port 3478, and UDP from port 41641. Admin interfaces you reach over the tailnet should listen on the tailnet address or on localhost, never on a public port.

Exit Nodes and Subnet Routers

  • Exit node: other devices send all their internet traffic through the server. Advertise it with sudo tailscale set --advertise-exit-node and approve it in the admin console.
  • Subnet router: tailnet devices reach a private network behind the server. Advertise it with sudo tailscale set --advertise-routes=10.0.0.0/24 and approve the route in the admin console.
  • Forwarding: on Linux both roles need IP forwarding switched on with sysctl first, as the vendor's subnet router documentation shows.

Key Expiry on Servers

Device keys expire after a period set for the tailnet (180 days by default for new tailnets), and the device must then sign in again. For a server that should stay connected, open the Machines page in the admin console, choose Disable Key Expiry in that machine's menu, and remove machines you retire.

Tailscale or Plain WireGuard?

TailscaleWireGuard
KeysHandled for youYou exchange them
Behind NATWorks without open portsNeeds one open UDP port
ControlVendor service or HeadscaleOnly your servers

For a VPN that depends on nothing outside your own servers, see how to set up a WireGuard VPN server.

Was this answer helpful?
Loading...