OpenClaw Connection Guide
This page focuses on one thing: the two most practical ways to connect to OpenClaw.
- LAN connection
- Tailscale remote connection
Both methods are centered around the gateway section in ~/.openclaw/openclaw.json, especially the initial connection token (gateway.auth.token).
Key Fields First (Applies to Both Methods)
{
"gateway": {
"mode": "local",
"bind": "lan",
"port": 18789,
"auth": {
"mode": "token",
"token": "replace with your own long token"
},
"tailscale": {
"mode": "off"
}
}
}Field notes:
gateway.modeHow the node runs Gateway. For most self-hosted cases, keeplocal.gateway.bindListening scope.loopbackis local-only;lanallows other devices in the same network.gateway.portGateway port. Common default is18789; clients must use the same port.gateway.auth.modeAuth mode.tokenis recommended.gateway.auth.tokenThe token clients must provide for initial connection (critical).gateway.tailscale.modeOpenClaw's built-in Tailscale integration mode. In this guide we keep itofffor simpler operations.
1. LAN Connection
Use this when your phone/computer and OpenClaw host are in the same LAN (same Wi-Fi or same subnet).
1) Recommended Gateway config
{
"gateway": {
"mode": "local",
"bind": "lan",
"port": 18789,
"auth": {
"mode": "token",
"token": "your connection token"
},
"tailscale": {
"mode": "off"
}
}
}Key points:
- Use
bind = lan, otherwise mobile devices cannot access Gateway from LAN. - Keep
auth.mode = token; do not switch tonone. - Keep
tailscale.mode = off; LAN mode does not require it.
2) Get the initial token (gateway.auth.token)
Read directly from config:
jq -r '.gateway.auth.token' ~/.openclaw/openclaw.jsonIf jq is not installed, open the file directly:
cat ~/.openclaw/openclaw.jsonThen locate:
"gateway": {
"auth": {
"mode": "token",
"token": "this is your initial connection token"
}
}After config changes, restart Gateway:
openclaw gateway restart3) Let OpenClaw modify config from Control UI (Optional)
In your deployed OpenClaw Control UI, you can send this prompt directly to your own OpenClaw so it updates ~/.openclaw/openclaw.json for LAN mode:
Please modify the gateway section in ~/.openclaw/openclaw.json with these requirements:
1) Set gateway.mode to "local"
2) Set gateway.bind to "lan"
3) Set gateway.port to 18789 (if this port is occupied, keep a valid available port and tell me)
4) Set gateway.auth.mode to "token"
5) Set gateway.tailscale.mode to "off"
6) Keep existing gateway.auth.token; if missing, generate a strong token and write it to gateway.auth.token
7) Validate JSON format after changes and print the final gateway config snippet
8) Print token retrieval command: jq -r '.gateway.auth.token' ~/.openclaw/openclaw.json
9) Do NOT restart Gateway; only remind me to restart manuallyImportant: Gateway restart must still be done manually.
- Terminal command:
openclaw gateway restart - Cloud-hosted deployment: restart the server or corresponding service
- Docker deployment: restart containers (
docker restart <container>ordocker compose restart)
4) Client connection
- In ClawPilot or another OpenClaw client, enter host LAN IP and
gateway.port. - Choose token as auth method.
- Paste
gateway.auth.tokento complete connection.
2. Tailscale Remote Connection
Tailscale is a secure device-networking tool that lets you access your home/office host from outside networks. Register: tailscale.com/start Install: tailscale.com/download
1) Recommended Gateway config (critical)
Keep it the same as LAN setup and do not enable OpenClaw built-in Tailscale mode:
{
"gateway": {
"mode": "local",
"bind": "lan",
"port": 18789,
"auth": {
"mode": "token",
"token": "your connection token"
},
"tailscale": {
"mode": "off"
}
}
}Why this is simpler:
gateway.tailscale.mode = offavoids extra mode complexity.- Continue using
gateway.auth.tokenas your primary auth method. - LAN and remote setup share the same auth logic, reducing troubleshooting cost.
2) Remote connection steps
- Install Tailscale on OpenClaw host and your phone/computer, then sign into the same account.
- On the host, get Tailscale IPv4:
tailscale ip -4- Get OpenClaw initial token:
jq -r '.gateway.auth.token' ~/.openclaw/openclaw.json- In ClawPilot or another OpenClaw client, enter
<tailscale-ip>:<gateway.port>, choose token auth, and paste token.
3) Let OpenClaw modify config from Control UI (Optional)
In your deployed OpenClaw Control UI, you can send this prompt so OpenClaw applies the minimal remote-ready config:
Please modify the gateway section in ~/.openclaw/openclaw.json for a minimal Tailscale remote setup with these requirements:
1) Set gateway.mode to "local"
2) Set gateway.bind to "lan"
3) Set gateway.port to 18789 (if this port is occupied, keep a valid available port and tell me)
4) Set gateway.auth.mode to "token"
5) Set gateway.tailscale.mode to "off"
6) Keep existing gateway.auth.token; if missing, generate a strong token and write it to gateway.auth.token
7) Validate JSON format after changes and print the final gateway config snippet
8) Print token retrieval command: jq -r '.gateway.auth.token' ~/.openclaw/openclaw.json
9) Do NOT restart Gateway; only remind me to restart manuallyImportant: Gateway restart must still be done manually.
- Terminal command:
openclaw gateway restart - Cloud-hosted deployment: restart the server or corresponding service
- Docker deployment: restart containers (
docker restart <container>ordocker compose restart)
4) Minimal troubleshooting order
openclaw gateway statustailscale status- Confirm client port matches
gateway.port - Confirm token exactly matches
gateway.auth.token
