brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: tailscale ip -4 prints the Tailscale address of this device, or of any other one

Network and access
~/tips/tailscale-ip

tailscale ip -4

Prints the Tailscale IPv4 address of this device, or of another device when you give its name.

I keep forgetting the 100.x address of my Unraid server, and I used to dig through the admin console to find it. The terminal has a shorter way.

Run this on any device that has Tailscale installed:

tailscale ip -4

It prints only the IPv4 address of that device on your tailnet, nothing else. Add a device name and you get the address of that device instead:

tailscale ip -4 my-server

Without a flag you get the IPv4 and the IPv6 address. The CLI reference lists the flags as --4, --6 and --1 (one address, IPv4 preferred), while its examples use -4. I would use the form from the examples, and check tailscale ip --help if your version complains. --assert=<ip> exits with an error when the device does not have that address, which is handy when a script must run on the right machine.

The output is a bare address, so it drops straight into other commands, for example ssh root@$(tailscale ip -4 my-server). On Unraid that also gives you a quick way to check that the server is on your tailnet before you blame the container.

One caveat: the name you pass is the device name from your tailnet, and it only resolves if that device is online and your tailnet knows it. If the command prints nothing useful, run tailscale status first.

Further reading: Tailscale CLI reference: tailscale ip, Tailscale on Unraid, Tip: tailscale ping, direct or relayed

More Network and access tips scp -3 alice@server-a:/var/backups/db.sql.gz bob@server-b:/srv/restore/ tailscale exit-node suggest tailscale lock sign nodekey:1abddef1 tlpub:abcdef12 wg genpsk > peer1.psk Table = off All Network and access tips (163) All topics

Link