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: tailscaled userspace networking runs Tailscale where no tun device exists

Network and access
~/tips/tip-tailscaled-userspace-networking

tailscaled --tun=userspace-networking --socks5-server=localhost:1055 --outbound-http-proxy-listen=localhost:1055 &

Run Tailscale in containers without a tun device and reach the tailnet through a proxy.

Some places cannot create a VPN interface: an unprivileged container, a serverless platform, a locked-down host. tailscaled has a userspace mode for exactly that.

tailscaled --tun=userspace-networking --socks5-server=localhost:1055 --outbound-http-proxy-listen=localhost:1055 &
tailscale up --auth-key=file:/run/secrets/ts-authkey

Without a tun device there is no Tailscale interface, so other programs cannot just connect to a 100.x address. tailscaled offers a SOCKS5 and an HTTP proxy instead, and in this example both share port 1055. Point your app at it:

ALL_PROXY=socks5://localhost:1055/ curl http://my-server:8080/

Incoming connections to the node still work, because tailscaled handles them itself.

The docs mention the HTTP proxy only does HTTP and HTTPS, while SOCKS5 is more general. They also warn that libraries differ in which variable they read, HTTP_PROXY or lowercase http_proxy, so some trial and error is normal.

For SSH from such a container, I find tailscale nc as ProxyCommand simpler than a proxy. And because these nodes come and go, an ephemeral auth key keeps the device list tidy.

Further reading: Userspace networking mode

Going deeper: Why a Tailscale device vanishes after 180 days, and how to stop it

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