docs/gateway/discovery.md
OpenClaw has two related but distinct discovery problems:
All network discovery/advertising lives in the Node Gateway
(openclaw gateway); clients (mac app, iOS) are consumers only.
127.0.0.1:18789
by default; bind it to LAN/tailnet via gateway.bind.127.0.0.1:18789 over SSH.Protocol details: Gateway protocol, Bridge protocol (legacy).
Multicast Bonjour is best-effort and does not cross networks. OpenClaw also
supports browsing the same gateway beacon via a configured wide-area DNS-SD
domain, so discovery can cover both local. on the same LAN and a configured
unicast DNS-SD domain for cross-network discovery.
The gateway advertises its WS endpoint via Bonjour when the bundled
bonjour plugin is enabled; clients browse and show a "pick a gateway" list,
then store the chosen endpoint.
Troubleshooting and beacon details: Bonjour.
Service type: _openclaw-gw._tcp (gateway transport beacon).
TXT keys (non-secret):
| Key | Notes |
|---|---|
role=gateway | Always present. |
transport=gateway | Always present. |
displayName=<name> | Operator-configured display name. |
lanHost=<hostname>.local | LAN mDNS advertiser only; not written by wide-area DNS-SD. |
gatewayPort=18789 | Gateway WS + HTTP port. |
gatewayTls=1 | Only when TLS is enabled. |
gatewayTlsSha256=<sha256> | Only when TLS is enabled and a fingerprint is available. |
tailnetDns=<magicdns> | Optional hint; auto-detected when Tailscale is available. |
sshPort=<port> | Present only when discovery.mdns.mode="full"; omitted (SSH defaults to 22) in the default "minimal" mode, on both the LAN advertiser and wide-area DNS-SD. |
cliPath=<path> | Same discovery.mdns.mode="full" gate as sshPort; a remote-install hint for the CLI path. |
A canvasPort TXT key is defined in the plugin discovery contract for a
future canvas host port, but no current code path sets a value, so it is
never emitted today.
Security notes:
lanHost, tailnetDns, or gatewayPort.gatewayTlsSha256 override a
previously stored pin.Enable, disable, and override:
openclaw plugins enable bonjour enables LAN multicast advertising.discovery.mdns.mode in openclaw.json controls mDNS broadcast:
"minimal" (default), "full" (adds cliPath/sshPort to both the LAN
beacon and any wide-area DNS-SD zone), or "off" (disables mDNS).OPENCLAW_DISABLE_BONJOUR=1 force-disables advertising; discovery.mdns.mode="off"
disables it independently. OPENCLAW_DISABLE_BONJOUR=0 is an explicit
opt-in that overrides the plugin's auto-disable inside a detected container
(Docker, containerd, Kubernetes, LXC); it does not override
discovery.mdns.mode="off". The bundled bonjour plugin auto-starts on
macOS hosts (enabledByDefaultOnPlatforms: ["darwin"]) and auto-disables
inside detected containers; Linux, Windows, and other containerized
deployments need explicit plugins enable bonjour.gateway.bind in ~/.openclaw/openclaw.json controls the Gateway bind mode.OPENCLAW_SSH_PORT overrides the advertised SSH port (only takes effect
when discovery.mdns.mode="full").OPENCLAW_TAILNET_DNS publishes a tailnetDns hint (MagicDNS).OPENCLAW_CLI_PATH overrides the advertised CLI path.For gateways on different physical networks, Bonjour will not help. The recommended direct target is a Tailscale MagicDNS name (preferred) or a stable tailnet IP.
If the gateway detects it is running under Tailscale, it publishes
tailnetDns as an optional hint for clients (including wide-area beacons).
The macOS app prefers MagicDNS names over raw Tailscale IPs for gateway
discovery, which stays reliable when tailnet IPs change (node restarts,
CGNAT reassignment) since MagicDNS resolves to the current IP automatically.
For mobile node pairing, discovery hints never relax transport security on tailnet/public routes:
wss:// or Tailscale Serve/Funnel).ws://.ws:// remains supported.When there is no direct route (or direct is disabled), clients can always connect via SSH by forwarding the loopback gateway port. See Remote access.
local. or the configured wide-area
domain, offer a one-tap "Use this gateway" choice and save it as the
direct endpoint.ws://.The gateway is the source of truth for node/client admission: