OpenClawSkills
GitHub
Gateway / 运用 • TutorialHeader.readTime

远程 Gateway 设置

SSH tunnel setup for connecting OpenClaw.app to a remote Gateway.

OpenClaw.app uses SSH tunnels to connect to remote gateways. This guide explains how to set it up.

Tutorial.step

概要

Terminal
┌─────────────────────────────────────────────────────────────┐
│                        Client Machine                          │
│                                                              │
│  OpenClaw.app ──► ws://127.0.0.1:18789 (local port)           │
│                     │                                        │
│                     ▼                                        │
│  SSH Tunnel ────────────────────────────────────────────────│
│                     │                                        │
└─────────────────────┼──────────────────────────────────────┘
                      │
                      ▼
┌─────────────────────────────────────────────────────────────┐
│                         Remote Machine                        │
│                                                              │
│  Gateway WebSocket ──► ws://127.0.0.1:18789 ──►              │
│                                                              │
└─────────────────────────────────────────────────────────────┘
Tutorial.step

快速设置

#

Tutorial.step

步骤 1:SSH 设置添加

Edit ''~/.ssh/config'' and add:

Ssh
Host remote-gateway
    HostName '<REMOTE_IP>'          # e.g., 172.27.187.184
    User '<REMOTE_USER>'            # e.g., jefferson
    LocalForward 18789 127.0.0.1:18789
    IdentityFile ~/.ssh/id_rsa

Replace ''<REMOTE_IP>'' and ''<REMOTE_USER>'' with your values.

#

Tutorial.step

步骤 2:SSH 密钥复制

公开密钥远程机器在复制执行(密码 1 回输入):

Bash
ssh-copy-id -i ~/.ssh/id_rsa '<REMOTE_USER>'@'<REMOTE_IP>'

#

Tutorial.step

步骤 3:网关令牌设置

Bash
launchctl setenv OPENCLAW_GATEWAY_TOKEN "'<your-token>'"

#

Tutorial.step

步骤 4:SSH 隧道开始

Bash
ssh -N remote-gateway &

#

Tutorial.step

步骤 5:OpenClaw.app 重启

Bash
open /path/to/OpenClaw.app

应用是 SSH 隧道通过在远程网关在连接执行。

Tutorial.step

故障排除

Check if tunnel is running:

Bash
ps aux | grep "ssh -N remote-gateway" | grep -v grep
lsof -i :18789

隧道重启执行:

Bash
launchctl kickstart -k gui/$UID/bot.molt.ssh-tunnel

隧道停止执行:

Bash
launchctl bootout gui/$UID/bot.molt.ssh-tunnel

--- |

ReferenceGatewayRemoteGatewayReadmePage.step08.item1

ReferenceGatewayRemoteGatewayReadmePage.step08.item2

ReferenceGatewayRemoteGatewayReadmePage.step08.item3

ReferenceGatewayRemoteGatewayReadmePage.step08.item4

OpenClaw.app connects to ''ws://127.0.0.1:18789'' on the client machine. The SSH tunnel forwards that connection to port 18789 on the remote machine where the gateway is running.