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 nc tests a port on another device over your tailnet

Network and access
~/tips/tip-tailscale-nc

tailscale nc my-server 8080

Opens a raw connection to a port on a tailnet device from the command line.

When an app on another device does not respond, I want to know whether its port is open before I start blaming the app. tailscale nc is a small netcat that travels over Tailscale.

The CLI reference describes it as connecting to a port on a host, wired to stdin and stdout. The host can be a MagicDNS name or a Tailscale IP:

tailscale nc my-server 8080

If the connection opens, whatever you type goes to the port and whatever comes back lands in your terminal. That makes a hand-built HTTP request easy, here against a web server on port 8080:

printf 'GET / HTTP/1.0\r\n\r\n' | tailscale nc my-server 8080

A status line and some headers mean the app is listening and reachable. If the command exits at once or just hangs, the port is closed or something sits in the way.

It works well next to tailscale ping my-server, which the reference describes as a ping exclusively over Tailscale. When the ping answers but nc does not, the device itself is reachable and the problem is higher up, in an access rule, a firewall on that machine or the app. When the ping fails too, I look at the connection between the two devices first.

One limit: nc goes through the local Tailscale client, so the Tailscale daemon has to be running on the machine you type it on. For a host I only know by its LAN address, I use the regular nc instead.

Further reading: Tailscale CLI reference (nc)

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