{"id":137,"date":"2026-03-21T22:47:19","date_gmt":"2026-03-21T14:47:19","guid":{"rendered":"https:\/\/pa.yingzhi8.cn\/index.php\/2026\/03\/21\/gateway-remote\/"},"modified":"2026-03-21T23:28:55","modified_gmt":"2026-03-21T15:28:55","slug":"gateway-remote","status":"publish","type":"post","link":"https:\/\/pa.yingzhi8.cn\/index.php\/2026\/03\/21\/gateway-remote\/","title":{"rendered":"\u8fdc\u7a0b\u8bbf\u95ee"},"content":{"rendered":"<h1>\u8fdc\u7a0b\u8bbf\u95ee<\/h1>\n<h1>\u8fdc\u7a0b\u8bbf\u95ee\uff08SSH\u3001\u96a7\u9053\u548c tailnet\uff09<\/h1>\n<p>\u672c\u4ed3\u5e93\u901a\u8fc7\u5728\u4e13\u7528\u4e3b\u673a\uff08\u684c\u9762\/\u670d\u52a1\u5668\uff09\u4e0a\u8fd0\u884c\u5355\u4e2a Gateway \u7f51\u5173 \u7f51\u5173\uff08\u4e3b\u8282\u70b9\uff09\u5e76\u8ba9\u5ba2\u6237\u7aef\u8fde\u63a5\u5230\u5b83\u6765\u652f\u6301&#8221;SSH \u8fdc\u7a0b&#8221;\u3002<\/p>\n<ul>\n<li>\u5bf9\u4e8e<strong>\u64cd\u4f5c\u5458\uff08\u4f60\/macOS \u5e94\u7528\uff09<\/strong>\uff1aSSH \u96a7\u9053\u662f\u901a\u7528\u7684\u56de\u9000\u65b9\u6848\u3002<\/li>\n<li>\u5bf9\u4e8e<strong>\u8282\u70b9\uff08iOS\/Android \u548c\u672a\u6765\u7684\u8bbe\u5907\uff09<\/strong>\uff1a\u8fde\u63a5\u5230 Gateway \u7f51\u5173 <strong>WebSocket<\/strong>\uff08LAN\/tailnet \u6216\u6839\u636e\u9700\u8981\u901a\u8fc7 SSH \u96a7\u9053\uff09\u3002<\/li>\n<\/ul>\n<h2>\u6838\u5fc3\u7406\u5ff5<\/h2>\n<ul>\n<li>Gateway \u7f51\u5173 WebSocket \u7ed1\u5b9a\u5230\u4f60\u914d\u7f6e\u7aef\u53e3\u7684 <strong>loopback<\/strong>\uff08\u9ed8\u8ba4\u4e3a 18789\uff09\u3002<\/li>\n<li>\u5bf9\u4e8e\u8fdc\u7a0b\u4f7f\u7528\uff0c\u4f60\u901a\u8fc7 SSH \u8f6c\u53d1\u8be5 loopback \u7aef\u53e3\uff08\u6216\u4f7f\u7528 tailnet\/VPN \u51cf\u5c11\u96a7\u9053\u9700\u6c42\uff09\u3002<\/li>\n<\/ul>\n<h2>\u5e38\u89c1\u7684 VPN\/tailnet \u8bbe\u7f6e\uff08\u667a\u80fd\u4f53\u6240\u5728\u4f4d\u7f6e\uff09<\/h2>\n<p>\u5c06 <strong>Gateway \u7f51\u5173 \u7f51\u5173\u4e3b\u673a<\/strong>\u89c6\u4e3a&#8221;\u667a\u80fd\u4f53\u6240\u5728\u7684\u4f4d\u7f6e&#8221;\u3002\u5b83\u62e5\u6709\u4f1a\u8bdd\u3001\u8eab\u4efd\u9a8c\u8bc1\u914d\u7f6e\u6587\u4ef6\u3001\u6e20\u9053\u548c\u72b6\u6001\u3002<br \/>\n\u4f60\u7684\u7b14\u8bb0\u672c\u7535\u8111\/\u684c\u9762\uff08\u548c\u8282\u70b9\uff09\u8fde\u63a5\u5230\u8be5\u4e3b\u673a\u3002<\/p>\n<h3>1) tailnet \u4e2d\u59cb\u7ec8\u5728\u7ebf\u7684 Gateway \u7f51\u5173 \u7f51\u5173\uff08VPS \u6216\u5bb6\u5ead\u670d\u52a1\u5668\uff09<\/h3>\n<p>\u5728\u6301\u4e45\u4e3b\u673a\u4e0a\u8fd0\u884c Gateway \u7f51\u5173 \u7f51\u5173\uff0c\u5e76\u901a\u8fc7 <strong>Tailscale<\/strong> \u6216 SSH \u8bbf\u95ee\u5b83\u3002<\/p>\n<ul>\n<li><strong>\u6700\u4f73\u7528\u6237\u4f53\u9a8c\uff1a<\/strong> \u4fdd\u6301 <code>gateway.bind: \"loopback\"<\/code> \u5e76\u4f7f\u7528 <strong>Tailscale Serve<\/strong> \u4f5c\u4e3a\u63a7\u5236 UI\u3002<\/li>\n<li><strong>\u56de\u9000\u65b9\u6848\uff1a<\/strong> \u4fdd\u6301 loopback + \u4ece\u4efb\u4f55\u9700\u8981\u8bbf\u95ee\u7684\u673a\u5668\u5efa\u7acb SSH \u96a7\u9053\u3002<\/li>\n<li><strong>\u793a\u4f8b\uff1a<\/strong> <a href=\"https:\/\/pa.yingzhi8.cn\/?p=157\">exe.dev<\/a>\uff08\u7b80\u6613 VM\uff09\u6216 <a href=\"https:\/\/pa.yingzhi8.cn\/?p=160\">Hetzner<\/a>\uff08\u751f\u4ea7 VPS\uff09\u3002<\/li>\n<\/ul>\n<p>\u5f53\u4f60\u7684\u7b14\u8bb0\u672c\u7535\u8111\u7ecf\u5e38\u4f11\u7720\u4f46\u4f60\u5e0c\u671b\u667a\u80fd\u4f53\u59cb\u7ec8\u5728\u7ebf\u65f6\uff0c\u8fd9\u662f\u7406\u60f3\u7684\u9009\u62e9\u3002<\/p>\n<h3>2) \u5bb6\u5ead\u684c\u9762\u8fd0\u884c Gateway \u7f51\u5173 \u7f51\u5173\uff0c\u7b14\u8bb0\u672c\u7535\u8111\u4f5c\u4e3a\u8fdc\u7a0b\u63a7\u5236<\/h3>\n<p>\u7b14\u8bb0\u672c\u7535\u8111<strong>\u4e0d<\/strong>\u8fd0\u884c\u667a\u80fd\u4f53\u3002\u5b83\u8fdc\u7a0b\u8fde\u63a5\uff1a<\/p>\n<ul>\n<li>\u4f7f\u7528 macOS \u5e94\u7528\u7684 <strong>Remote over SSH<\/strong> \u6a21\u5f0f\uff08\u8bbe\u7f6e \u2192 \u901a\u7528 \u2192 &#8220;OpenClaw runs&#8221;\uff09\u3002<\/li>\n<li>\u5e94\u7528\u6253\u5f00\u5e76\u7ba1\u7406\u96a7\u9053\uff0c\u56e0\u6b64 WebChat + \u5065\u5eb7\u68c0\u67e5&#8221;\u76f4\u63a5\u5de5\u4f5c&#8221;\u3002<\/li>\n<\/ul>\n<p>\u64cd\u4f5c\u624b\u518c\uff1a<a href=\"https:\/\/pa.yingzhi8.cn\/?p=199\">macOS \u8fdc\u7a0b\u8bbf\u95ee<\/a>\u3002<\/p>\n<h3>3) \u7b14\u8bb0\u672c\u7535\u8111\u8fd0\u884c Gateway \u7f51\u5173 \u7f51\u5173\uff0c\u4ece\u5176\u4ed6\u673a\u5668\u8fdc\u7a0b\u8bbf\u95ee<\/h3>\n<p>\u4fdd\u6301 Gateway \u7f51\u5173 \u7f51\u5173\u5728\u672c\u5730\u4f46\u5b89\u5168\u5730\u66b4\u9732\u5b83\uff1a<\/p>\n<ul>\n<li>\u4ece\u5176\u4ed6\u673a\u5668\u5230\u7b14\u8bb0\u672c\u7535\u8111\u7684 SSH \u96a7\u9053\uff0c\u6216<\/li>\n<li>Tailscale Serve \u63a7\u5236 UI \u5e76\u4fdd\u6301 Gateway \u7f51\u5173 \u7f51\u5173\u4ec5 loopback\u3002<\/li>\n<\/ul>\n<p>\u6307\u5357\uff1a<a href=\"https:\/\/pa.yingzhi8.cn\/?p=142\">Tailscale<\/a> \u548c <a href=\"https:\/\/pa.yingzhi8.cn\/?p=755\">Web \u6982\u89c8<\/a>\u3002<\/p>\n<h2>\u547d\u4ee4\u6d41\uff08\u4ec0\u4e48\u5728\u54ea\u91cc\u8fd0\u884c\uff09<\/h2>\n<p>\u4e00\u4e2a Gateway \u7f51\u5173 \u7f51\u5173\u670d\u52a1\u62e5\u6709\u72b6\u6001 + \u6e20\u9053\u3002\u8282\u70b9\u662f\u5916\u56f4\u8bbe\u5907\u3002<\/p>\n<p>\u6d41\u7a0b\u793a\u4f8b\uff08Telegram \u2192 \u8282\u70b9\uff09\uff1a<\/p>\n<ul>\n<li>Telegram \u6d88\u606f\u5230\u8fbe <strong>Gateway \u7f51\u5173 \u7f51\u5173<\/strong>\u3002<\/li>\n<li>Gateway \u7f51\u5173 \u7f51\u5173\u8fd0\u884c<strong>\u667a\u80fd\u4f53<\/strong>\u5e76\u51b3\u5b9a\u662f\u5426\u8c03\u7528\u8282\u70b9\u5de5\u5177\u3002<\/li>\n<li>Gateway \u7f51\u5173 \u7f51\u5173\u901a\u8fc7 Gateway \u7f51\u5173 WebSocket \u8c03\u7528<strong>\u8282\u70b9<\/strong>\uff08<code>node.*<\/code> RPC\uff09\u3002<\/li>\n<li>\u8282\u70b9\u8fd4\u56de\u7ed3\u679c\uff1bGateway \u7f51\u5173 \u7f51\u5173\u56de\u590d\u5230 Telegram\u3002<\/li>\n<\/ul>\n<p>\u8bf4\u660e\uff1a<\/p>\n<ul>\n<li><strong>\u8282\u70b9\u4e0d\u8fd0\u884c Gateway \u7f51\u5173 \u7f51\u5173\u670d\u52a1\u3002<\/strong> \u9664\u975e\u4f60\u6709\u610f\u8fd0\u884c\u9694\u79bb\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u5426\u5219\u6bcf\u53f0\u4e3b\u673a\u53ea\u5e94\u8fd0\u884c\u4e00\u4e2a Gateway \u7f51\u5173 \u7f51\u5173\uff08\u53c2\u89c1<a href=\"https:\/\/pa.yingzhi8.cn\/?p=131\">\u591a Gateway \u7f51\u5173 \u7f51\u5173<\/a>\uff09\u3002<\/li>\n<li>macOS \u5e94\u7528\u7684&#8221;\u8282\u70b9\u6a21\u5f0f&#8221;\u53ea\u662f\u901a\u8fc7 Gateway \u7f51\u5173 WebSocket \u7684\u8282\u70b9\u5ba2\u6237\u7aef\u3002<\/li>\n<\/ul>\n<h2>SSH \u96a7\u9053\uff08CLI + \u5de5\u5177\uff09<\/h2>\n<p>\u521b\u5efa\u5230\u8fdc\u7a0b Gateway \u7f51\u5173 WS \u7684\u672c\u5730\u96a7\u9053\uff1a<\/p>\n<p>&#8220;`bash  theme={&#8220;theme&#8221;:{&#8220;light&#8221;:&#8221;min-light&#8221;,&#8221;dark&#8221;:&#8221;min-dark&#8221;}}<br \/>\nssh -N -L 18789:127.0.0.1:18789 user@host<\/p>\n<pre><code>\n\u96a7\u9053\u5efa\u7acb\u540e\uff1a\n\n* `openclaw health` \u548c `openclaw status --deep` \u73b0\u5728\u901a\u8fc7 `ws:\/\/127.0.0.1:18789` \u8bbf\u95ee\u8fdc\u7a0b Gateway \u7f51\u5173\u3002\n* `openclaw gateway {status,health,send,agent,call}` \u5728\u9700\u8981\u65f6\u4e5f\u53ef\u4ee5\u901a\u8fc7 `--url` \u6307\u5b9a\u8f6c\u53d1\u7684 URL\u3002\n\n\u6ce8\u610f\uff1a\u5c06 `18789` \u66ff\u6362\u4e3a\u4f60\u914d\u7f6e\u7684 `gateway.port`\uff08\u6216 `--port`\/`OPENCLAW_GATEWAY_PORT`\uff09\u3002\n\n## CLI \u8fdc\u7a0b\u9ed8\u8ba4\u503c\n\n\u4f60\u53ef\u4ee5\u6301\u4e45\u5316\u8fdc\u7a0b\u76ee\u6807\uff0c\u4ee5\u4fbf CLI \u547d\u4ee4\u9ed8\u8ba4\u4f7f\u7528\u5b83\uff1a\n\n```json5  theme={&quot;theme&quot;:{&quot;light&quot;:&quot;min-light&quot;,&quot;dark&quot;:&quot;min-dark&quot;}}\n{\n  gateway: {\n    mode: &quot;remote&quot;,\n    remote: {\n      url: &quot;ws:\/\/127.0.0.1:18789&quot;,\n      token: &quot;your-token&quot;,\n    },\n  },\n}\n<\/code><\/pre>\n<p>\u5f53 Gateway \u7f51\u5173 \u7f51\u5173\u4ec5\u9650 loopback \u65f6\uff0c\u4fdd\u6301 URL \u4e3a <code>ws:\/\/127.0.0.1:18789<\/code> \u5e76\u5148\u6253\u5f00 SSH \u96a7\u9053\u3002<\/p>\n<h2>\u901a\u8fc7 SSH \u7684\u804a\u5929 UI<\/h2>\n<p>WebChat \u4e0d\u518d\u4f7f\u7528\u5355\u72ec\u7684 HTTP \u7aef\u53e3\u3002SwiftUI \u804a\u5929 UI \u76f4\u63a5\u8fde\u63a5\u5230 Gateway \u7f51\u5173 WebSocket\u3002<\/p>\n<ul>\n<li>\u901a\u8fc7 SSH \u8f6c\u53d1 <code>18789<\/code>\uff08\u89c1\u4e0a\u6587\uff09\uff0c\u7136\u540e\u8ba9\u5ba2\u6237\u7aef\u8fde\u63a5\u5230 <code>ws:\/\/127.0.0.1:18789<\/code>\u3002<\/li>\n<li>\u5728 macOS \u4e0a\uff0c\u4f18\u5148\u4f7f\u7528\u5e94\u7528\u7684&#8221;Remote over SSH&#8221;\u6a21\u5f0f\uff0c\u5b83\u4f1a\u81ea\u52a8\u7ba1\u7406\u96a7\u9053\u3002<\/li>\n<\/ul>\n<h2>macOS \u5e94\u7528&#8221;Remote over SSH&#8221;<\/h2>\n<p>macOS \u83dc\u5355\u680f\u5e94\u7528\u53ef\u4ee5\u7aef\u5230\u7aef\u9a71\u52a8\u76f8\u540c\u7684\u8bbe\u7f6e\uff08\u8fdc\u7a0b\u72b6\u6001\u68c0\u67e5\u3001WebChat \u548c\u8bed\u97f3\u5524\u9192\u8f6c\u53d1\uff09\u3002<\/p>\n<p>\u64cd\u4f5c\u624b\u518c\uff1a<a href=\"https:\/\/pa.yingzhi8.cn\/?p=199\">macOS \u8fdc\u7a0b\u8bbf\u95ee<\/a>\u3002<\/p>\n<h2>\u5b89\u5168\u89c4\u5219\uff08\u8fdc\u7a0b\/VPN\uff09<\/h2>\n<p>\u7b80\u77ed\u7248\u672c\uff1a<strong>\u4fdd\u6301 Gateway \u7f51\u5173 \u7f51\u5173\u4ec5 loopback<\/strong>\uff0c\u9664\u975e\u4f60\u786e\u5b9a\u9700\u8981\u7ed1\u5b9a\u3002<\/p>\n<ul>\n<li><strong>Loopback + SSH\/Tailscale Serve<\/strong> \u662f\u6700\u5b89\u5168\u7684\u9ed8\u8ba4\u8bbe\u7f6e\uff08\u65e0\u516c\u5f00\u66b4\u9732\uff09\u3002<\/li>\n<li><strong>\u975e loopback \u7ed1\u5b9a<\/strong>\uff08<code>lan<\/code>\/<code>tailnet<\/code>\/<code>custom<\/code>\uff0c\u6216\u5f53 loopback \u4e0d\u53ef\u7528\u65f6\u7684 <code>auto<\/code>\uff09\u5fc5\u987b\u4f7f\u7528\u8eab\u4efd\u9a8c\u8bc1\u4ee4\u724c\/\u5bc6\u7801\u3002<\/li>\n<li><code>gateway.remote.token<\/code> <strong>\u4ec5<\/strong>\u7528\u4e8e\u8fdc\u7a0b CLI \u8c03\u7528\u2014\u2014\u5b83<strong>\u4e0d<\/strong>\u542f\u7528\u672c\u5730\u8eab\u4efd\u9a8c\u8bc1\u3002<\/li>\n<li><code>gateway.remote.tlsFingerprint<\/code> \u5728\u4f7f\u7528 <code>wss:\/\/<\/code> \u65f6\u56fa\u5b9a\u8fdc\u7a0b TLS \u8bc1\u4e66\u3002<\/li>\n<li>\u5f53 <code>gateway.auth.allowTailscale: true<\/code> \u65f6\uff0c<strong>Tailscale Serve<\/strong> \u53ef\u4ee5\u901a\u8fc7\u8eab\u4efd\u6807\u5934\u8fdb\u884c\u8eab\u4efd\u9a8c\u8bc1\u3002\u5982\u679c\u4f60\u60f3\u4f7f\u7528\u4ee4\u724c\/\u5bc6\u7801\uff0c\u8bf7\u5c06\u5176\u8bbe\u7f6e\u4e3a <code>false<\/code>\u3002<\/li>\n<li>\u5c06\u6d4f\u89c8\u5668\u63a7\u5236\u89c6\u4e3a\u64cd\u4f5c\u5458\u8bbf\u95ee\uff1a\u4ec5\u9650 tailnet + \u6709\u610f\u7684\u8282\u70b9\u914d\u5bf9\u3002<\/li>\n<\/ul>\n<p>\u6df1\u5165\u4e86\u89e3\uff1a<a href=\"https:\/\/pa.yingzhi8.cn\/?p=747\">\u5b89\u5168<\/a>\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8fdc\u7a0b\u8bbf\u95ee \u8fdc\u7a0b\u8bbf\u95ee\uff08SSH\u3001\u96a7\u9053\u548c tailnet\uff09 \u672c\u4ed3\u5e93\u901a\u8fc7\u5728\u4e13\u7528\u4e3b\u673a\uff08\u684c\u9762\/\u670d\u52a1\u5668\uff09\u4e0a\u8fd0\u884c\u5355\u4e2a Gate [&hellip;]<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-137","post","type-post","status-publish","format-standard","hentry","category-docs"],"_links":{"self":[{"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts\/137","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/comments?post=137"}],"version-history":[{"count":2,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts\/137\/revisions"}],"predecessor-version":[{"id":820,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts\/137\/revisions\/820"}],"wp:attachment":[{"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/media?parent=137"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/categories?post=137"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/tags?post=137"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}