# Bonjour Discovery

## Overview

OpenClaw employs Bonjour (mDNS / DNS-SD) primarily as a **LAN-only convenience** to discover an active Gateway (WebSocket endpoint).

## Key Capabilities

The system supports wide-area discovery through Tailscale by implementing unicast DNS-SD. This approach involves:

1. Operating a DNS server on the gateway accessible via Tailnet
2. Publishing DNS-SD records for `_openclaw-gw._tcp`
3. Configuring Tailscale split DNS for domain resolution

## Gateway Configuration

The recommended setup binds exclusively to the tailnet:

```json5
{
  gateway: { bind: "tailnet" },
  discovery: { wideArea: { enabled: true } },
}
```

## Service Advertisement

Only the Gateway advertises `_openclaw-gw._tcp`. The service broadcasts non-secret metadata including friendly names, port information, TLS status, and optional CLI paths through TXT records.

## Troubleshooting Approaches

- Use `dns-sd -B _openclaw-gw._tcp local.` for browsing instances on macOS
- Check Gateway logs for entries beginning with `bonjour:`
- On iOS, access Discovery Debug Logs via Settings -> Gateway -> Advanced
- Consider that **Bonjour doesn't cross networks**: use Tailnet or SSH

## Disabling Features

Set `OPENCLAW_DISABLE_BONJOUR=1` to disable advertising functionality entirely.
