Run a Cloud Relay and Tor/Tails guidance
Peers behind residential NATs or cellular carriers reach each other through a lightweight Circuit Relay v2 node (--mode infrastructure) and upgrade to direct connections via DCUtR hole punching whenever possible. A relay only forwards Noise-encrypted bytes and never sees plaintext prompts or responses.
Roaming reliability and private-network discovery#
Laptops and GPU helpers move between home Wi-Fi, office networks, VPNs, and cellular hotspots without needing manual restarts:
- Dual QUIC + TCP listeners: Nodes listen on both QUIC v1 (UDP/TLS 1.3) and TCP (Noise XX) so fast direct links establish cleanly wherever UDP is allowed while TCP relays keep working through restrictive firewalls.
- Fast dead-link eviction (
15sping keepalives):phase-netruns libp2ppingevery15s(15stimeout) and immediately closes unresponsive sockets after sleep, Wi-Fi switches, or carrier NAT drops instead of waiting minutes for a stale TCP timeout. - Self-healing relay reservations: When a relay listener closes or its reservation address expires, background maintenance automatically re-dials the relay and re-establishes the circuit reservation.
- Automatic direct-path preference: As soon as a direct or DCUtR hole-punched connection comes up to a peer,
phase-netautomatically prunes redundant relayed circuits to that peer so inference and/phase/shard-rpc/1.0.0tunnels never accidentally ride a slower relay. - Private-network-friendly discovery: Local mDNS and explicit LAN
--bootstrap-peerroutes keep their provenance and remain routable in Kademlia even when mixed with public bootstrap seeds—so machines on the same Wi-Fi or studio LAN discover and talk directly without hairpinning through the internet.
One-command Linux Cloud Relay setup#
Any small Linux VPS with a public IPv4 address (~24 MiB RSS in practice) can serve as a private or community relay using scripts/setup-cloud-relay.sh:
curl -fsSL https://raw.githubusercontent.com/msitarzewski/phase/main/scripts/setup-cloud-relay.sh -o setup-cloud-relay.sh
sudo bash setup-cloud-relay.sh --ip 203.0.113.10 --port 443What the script sets up (fail-closed):
- Rejects loopback, RFC 1918, link-local, and CGNAT addresses for
--ip. - Downloads the verified
luciddrelease bundle (SHA256SUMS.txtchecked). - Creates an unprivileged system user
lucid(/usr/sbin/nologin). - Installs a hardened systemd unit (
/etc/systemd/system/lucidd-relay.service) withNoNewPrivileges=yes,ProtectSystem=strict,MemoryDenyWriteExecute=yes, and—only when--port 443is selected—AmbientCapabilities=CAP_NET_BIND_SERVICEso restrictive corporate/hotel firewalls that block port4001still pass traffic. - Opens the chosen TCP port in
ufw(unless--no-firewallis passed). - Prints the node's exact PeerID-pinned multiaddr and DNS TXT record value.
Note
Running without sudo installs a user systemd unit with loginctl enable-linger on port 4001 (port 443 requires root for CAP_NET_BIND_SERVICE). Public rendezvous serving stays disabled in lucidd infrastructure mode until upstream registration-count quotas are available.
Hardened relay limits in phase-net#
Circuit Relay v2 server mode is strictly bounded against abuse:
- Default reservations:
128total,2per peer,1 hourduration (hard ceiling1024/8/1h). - Default circuits:
256total,4per peer,2 minuteduration,64 MiBper circuit (hard ceiling2048/16/1h/1 GiB).
PeerID-pinned DNS TXT bootstrap#
By default, lucidd resolves TXT records on bootstrap.phasebased.net via your system DNS resolver (--bootstrap-dns, up to 64 addresses per domain). Every TXT record must end with /p2p/<PeerId>, which Noise authenticates on dial.
To run your own private relay without touching the default bootstrap domain:
lucidd \
--no-default-bootstrap \
--bootstrap-peer /ip4/203.0.113.10/tcp/443/p2p/12D3KooWYourRelayPeerId \
--relay-peer /ip4/203.0.113.10/tcp/443/p2p/12D3KooWYourRelayPeerIdOr publish a TXT record on your own domain (_dns value /ip4/203.0.113.10/tcp/443/p2p/12D3KooW...) and pass --no-default-bootstrap --bootstrap-dns bootstrap.example.org.
Warning
System DNS TXT lookups do not enforce DNSSEC today; --dns-fallback (off by default) falls back to 1.1.1.1 only if you opt in. For maximum bootstrap certainty, pin --no-default-bootstrap --relay-peer <multiaddr> directly.
Running over Tor and TailsOS#
phase-net and lucidd include native, fail-closed --tor-socks5 & v3 .onion transport (zero-unsafe RFC 1928/1929 SOCKS5h with remote DNS resolution through Tor). You can run LUCID over Tor on macOS, Linux, Windows, or TailsOS in Join-Only mode:
lucidd \
--mode consume-only \
--tor-socks5 127.0.0.1:9050 \
--no-default-bootstrap \
--bootstrap-peer /onion3/<your-relay-56-char-v3-address>:443/p2p/12D3KooWYourRelayPeerId \
--relay-peer /onion3/<your-relay-56-char-v3-address>:443/p2p/12D3KooWYourRelayPeerIdIn LUCID Desktop, launch with LUCID_TOR_SOCKS5=127.0.0.1:9050 (on TailsOS, the Tor daemon listens on 127.0.0.1:9050 by default).
What --tor-socks5 enforces automatically (fail-closed):
- Zero direct TCP/QUIC listen sockets, zero mDNS LAN discovery, zero DCUtR hole punching, and zero AutoNAT probes
- Zero clearnet model/runtime downloads and local providing disabled (Join-Only Consumer UI)
- RAM-only chat history: Local disk chat history is hard-locked off so nothing is written to disk
- Tor-native DuckDuckGo
.onionSearch &.onionWeb Fetch: Built-in Chat Web Search and Web Fetch route strictly throughsocks5h://(remote DNS via Tor) targeting DuckDuckGo's official.onionservice - External MCP subprocess lockdown: Third-party stdio MCP binaries are automatically disabled so an external subprocess cannot bypass the SOCKS5h proxy
Honest Tor & TailsOS caveats#
- Serving peers still see plaintext prompts: Tor hides your IP address from the relay and serving peer; it does not hide your prompt text from the serving peer executing inference.
- Avoid private LAN multiaddrs: Even when TailsOS's kernel firewall blocks non-Tor internet traffic, only dial Tor
.onionor public relay addresses when you require strict Tor-only routing. - Use TCP port
443or v3.onionrelays: Tor only carries TCP (never UDP/QUIC), and.onionrelays keep traffic end-to-end inside Tor without using an exit node. - Use an ephemeral identity (
--identity-path /tmp/ephemeral.key) if you do not want sessions linked across reboots byPeerId.