~/nikmel.xyz $ cat notes/two-tailnets-on-one-mac.md

two tailnets on one mac

the Tailscale app keeps one tailnet active at a time. i want my personal tailnet running next to the work one

tested: macOS 27, tailscale 1.104 (brew)

date:

the work tailnet stays in the Tailscale app. the personal one runs as a second tailscaled in userspace mode. it exposes a socks5 proxy on localhost:1055 and everything personal goes through that.

daemon

create a LaunchAgent so the daemon starts at login:

nano ~/Library/LaunchAgents/local.tailscaled-personal.plist

paste this, replacing YOU with your username:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key><string>local.tailscaled-personal</string>
  <key>ProgramArguments</key>
  <array>
    <string>/opt/homebrew/bin/tailscaled</string>
    <string>--tun=userspace-networking</string>
    <string>--statedir=/Users/YOU/.tailscale-personal</string>
    <string>--socket=/Users/YOU/.tailscale-personal/tailscaled.sock</string>
    <string>--port=41642</string>
    <string>--socks5-server=localhost:1055</string>
  </array>
  <key>RunAtLoad</key><true/>
  <key>KeepAlive</key><true/>
  <key>StandardErrorPath</key><string>/tmp/tailscaled-personal.log</string>
</dict>
</plist>

then install tailscaled, load the agent and log in to your personal tailnet:

brew install tailscale
mkdir -p ~/.tailscale-personal && chmod 700 ~/.tailscale-personal
launchctl load ~/Library/LaunchAgents/local.tailscaled-personal.plist

alias tsp='tailscale --socket=$HOME/.tailscale-personal/tailscaled.sock'   # ~/.zshrc
tsp up --hostname=mac-personal
tsp status

ssh

to SSH through the personal tailnet, add this to ~/.ssh/config:

nano ~/.ssh/config
Host *.your-tailnet.ts.net
  ProxyCommand nc -X 5 -x localhost:1055 %h %p
  ControlMaster auto
  ControlPath ~/.ssh/cm-%r@%h:%p
  ControlPersist 10m

note: replace your-tailnet.ts.net with your tailnet name from the admin console.

browser

in Firefox you can set a SOCKS5 proxy (localhost:1055, “Proxy DNS” on) in settings. for Chrome, run a separate instance like this:

open -na "Google Chrome" --args \
  --user-data-dir="$HOME/.chrome-personal-tailnet" \
  --proxy-server="socks5://localhost:1055"

screen sharing

i often connect to my personal MacBook via screen share. here is how to do it via the personal tailnet:

ssh -N -L 5901:localhost:5900 mymac.your-tailnet.ts.net
open vnc://127.0.0.1:5901

note: 5901 on purpose. Screen Sharing refuses localhost:5900 because it thinks you’re connecting to your own Mac. the remote Mac needs Remote Login (System Settings → General → Sharing) or Tailscale SSH on, since this goes over SSH.

notes

  • you can also run the personal tailscaled inside a container (i’ve tried it with Apple containers)