{"id":142,"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-tailscale\/"},"modified":"2026-03-21T23:28:58","modified_gmt":"2026-03-21T15:28:58","slug":"gateway-tailscale","status":"publish","type":"post","link":"https:\/\/pa.yingzhi8.cn\/index.php\/2026\/03\/21\/gateway-tailscale\/","title":{"rendered":"Tailscale"},"content":{"rendered":"<h1>Tailscale<\/h1>\n<h1>Tailscale\uff08Gateway \u7f51\u5173 \u7f51\u5173\u4eea\u8868\u76d8\uff09<\/h1>\n<p>OpenClaw \u53ef\u4ee5\u4e3a Gateway \u7f51\u5173 \u7f51\u5173\u4eea\u8868\u76d8\u548c WebSocket \u7aef\u53e3\u81ea\u52a8\u914d\u7f6e Tailscale <strong>Serve<\/strong>\uff08tailnet\uff09\u6216 <strong>Funnel<\/strong>\uff08\u516c\u5171\uff09\u3002\u8fd9\u4f7f Gateway \u7f51\u5173 \u7f51\u5173\u4fdd\u6301\u7ed1\u5b9a\u5230 loopback\uff0c\u540c\u65f6 Tailscale \u63d0\u4f9b HTTPS\u3001\u8def\u7531\u548c\uff08\u5bf9\u4e8e Serve\uff09\u8eab\u4efd\u5934\u3002<\/p>\n<h2>\u6a21\u5f0f<\/h2>\n<ul>\n<li><code>serve<\/code>\uff1a\u4ec5\u9650 Tailnet \u7684 Serve\uff0c\u901a\u8fc7 <code>tailscale serve<\/code>\u3002Gateway \u7f51\u5173 \u7f51\u5173\u4fdd\u6301\u5728 <code>127.0.0.1<\/code> \u4e0a\u3002<\/li>\n<li><code>funnel<\/code>\uff1a\u901a\u8fc7 <code>tailscale funnel<\/code> \u7684\u516c\u5171 HTTPS\u3002OpenClaw \u9700\u8981\u5171\u4eab\u5bc6\u7801\u3002<\/li>\n<li><code>off<\/code>\uff1a\u9ed8\u8ba4\uff08\u65e0 Tailscale \u81ea\u52a8\u5316\uff09\u3002<\/li>\n<\/ul>\n<h2>\u8ba4\u8bc1<\/h2>\n<p>\u8bbe\u7f6e <code>gateway.auth.mode<\/code> \u6765\u63a7\u5236\u63e1\u624b\uff1a<\/p>\n<ul>\n<li><code>token<\/code>\uff08\u8bbe\u7f6e <code>OPENCLAW_GATEWAY_TOKEN<\/code> \u65f6\u7684\u9ed8\u8ba4\u503c\uff09<\/li>\n<li><code>password<\/code>\uff08\u901a\u8fc7 <code>OPENCLAW_GATEWAY_PASSWORD<\/code> \u6216\u914d\u7f6e\u7684\u5171\u4eab\u5bc6\u94a5\uff09<\/li>\n<\/ul>\n<p>\u5f53 <code>tailscale.mode = \"serve\"<\/code> \u4e14 <code>gateway.auth.allowTailscale<\/code> \u4e3a <code>true<\/code> \u65f6\uff0c<br \/>\n\u6709\u6548\u7684 Serve \u4ee3\u7406\u8bf7\u6c42\u53ef\u4ee5\u901a\u8fc7 Tailscale \u8eab\u4efd\u5934\uff08<code>tailscale-user-login<\/code>\uff09\u8fdb\u884c\u8ba4\u8bc1\uff0c\u65e0\u9700\u63d0\u4f9b\u4ee4\u724c\/\u5bc6\u7801\u3002OpenClaw \u901a\u8fc7\u672c\u5730 Tailscale \u5b88\u62a4\u8fdb\u7a0b\uff08<code>tailscale whois<\/code>\uff09\u89e3\u6790 <code>x-forwarded-for<\/code> \u5730\u5740\u5e76\u5c06\u5176\u4e0e\u5934\u5339\u914d\u6765\u9a8c\u8bc1\u8eab\u4efd\uff0c\u7136\u540e\u624d\u63a5\u53d7\u5b83\u3002<br \/>\nOpenClaw \u4ec5\u5728\u8bf7\u6c42\u4ece loopback \u5230\u8fbe\u5e76\u5e26\u6709 Tailscale \u7684 <code>x-forwarded-for<\/code>\u3001<code>x-forwarded-proto<\/code> \u548c <code>x-forwarded-host<\/code> \u5934\u65f6\u624d\u5c06\u5176\u89c6\u4e3a Serve \u8bf7\u6c42\u3002<br \/>\n\u8981\u8981\u6c42\u663e\u5f0f\u51ed\u8bc1\uff0c\u8bbe\u7f6e <code>gateway.auth.allowTailscale: false<\/code> \u6216\u5f3a\u5236 <code>gateway.auth.mode: \"password\"<\/code>\u3002<\/p>\n<h2>\u914d\u7f6e\u793a\u4f8b<\/h2>\n<h3>\u4ec5\u9650 Tailnet\uff08Serve\uff09<\/h3>\n<p>&#8220;`json5  theme={&#8220;theme&#8221;:{&#8220;light&#8221;:&#8221;min-light&#8221;,&#8221;dark&#8221;:&#8221;min-dark&#8221;}}<br \/>\n{<br \/>\n  \u7f51\u5173: {<br \/>\n    bind: &#8220;loopback&#8221;,<br \/>\n    tailscale: { mode: &#8220;serve&#8221; },<br \/>\n  },<br \/>\n}<\/p>\n<pre><code>\n\u6253\u5f00\uff1a`https:\/\/&lt;magicdns&gt;\/`\uff08\u6216\u4f60\u914d\u7f6e\u7684 `gateway.controlUi.basePath`\uff09\n\n### \u4ec5\u9650 Tailnet\uff08\u7ed1\u5b9a\u5230 Tailnet IP\uff09\n\n\u5f53\u4f60\u5e0c\u671b Gateway \u7f51\u5173\u76f4\u63a5\u76d1\u542c Tailnet IP \u65f6\u4f7f\u7528\u6b64\u65b9\u5f0f\uff08\u65e0 Serve\/Funnel\uff09\u3002\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    bind: &quot;tailnet&quot;,\n    auth: { mode: &quot;token&quot;, token: &quot;your-token&quot; },\n  },\n}\n<\/code><\/pre>\n<p>\u4ece\u53e6\u4e00\u4e2a Tailnet \u8bbe\u5907\u8fde\u63a5\uff1a<\/p>\n<ul>\n<li>\u63a7\u5236 UI\uff1a<code>http:\/\/&lt;tailscale-ip&gt;:18789\/<\/code><\/li>\n<li>WebSocket\uff1a<code>ws:\/\/&lt;tailscale-ip&gt;:18789<\/code><\/li>\n<\/ul>\n<p>\u6ce8\u610f\uff1a\u5728\u6b64\u6a21\u5f0f\u4e0b loopback\uff08<code>http:\/\/127.0.0.1:18789<\/code>\uff09\u5c06<strong>\u4e0d<\/strong>\u5de5\u4f5c\u3002<\/p>\n<h3>\u516c\u5171\u4e92\u8054\u7f51\uff08Funnel + \u5171\u4eab\u5bc6\u7801\uff09<\/h3>\n<p>&#8220;`json5  theme={&#8220;theme&#8221;:{&#8220;light&#8221;:&#8221;min-light&#8221;,&#8221;dark&#8221;:&#8221;min-dark&#8221;}}<br \/>\n{<br \/>\n  \u7f51\u5173: {<br \/>\n    bind: &#8220;loopback&#8221;,<br \/>\n    tailscale: { mode: &#8220;funnel&#8221; },<br \/>\n    auth: { mode: &#8220;password&#8221;, password: &#8220;replace-me&#8221; },<br \/>\n  },<br \/>\n}<\/p>\n<pre><code>\n\u4f18\u5148\u4f7f\u7528 `OPENCLAW_GATEWAY_PASSWORD` \u800c\u4e0d\u662f\u5c06\u5bc6\u7801\u63d0\u4ea4\u5230\u78c1\u76d8\u3002\n\n## CLI \u793a\u4f8b\n\n```bash  theme={&quot;theme&quot;:{&quot;light&quot;:&quot;min-light&quot;,&quot;dark&quot;:&quot;min-dark&quot;}}\nopenclaw gateway --tailscale serve\nopenclaw gateway --tailscale funnel --auth password\n<\/code><\/pre>\n<h2>\u6ce8\u610f\u4e8b\u9879<\/h2>\n<ul>\n<li>Tailscale Serve\/Funnel \u9700\u8981\u5b89\u88c5\u5e76\u767b\u5f55 <code>tailscale<\/code> CLI\u3002<\/li>\n<li><code>tailscale.mode: \"funnel\"<\/code> \u9664\u975e\u8ba4\u8bc1\u6a21\u5f0f\u4e3a <code>password<\/code>\uff0c\u5426\u5219\u62d2\u7edd\u542f\u52a8\uff0c\u4ee5\u907f\u514d\u516c\u5171\u66b4\u9732\u3002<\/li>\n<li>\u5982\u679c\u4f60\u5e0c\u671b OpenClaw \u5728\u5173\u95ed\u65f6\u64a4\u9500 <code>tailscale serve<\/code> \u6216 <code>tailscale funnel<\/code> \u914d\u7f6e\uff0c\u8bbe\u7f6e <code>gateway.tailscale.resetOnExit<\/code>\u3002<\/li>\n<li><code>gateway.bind: \"tailnet\"<\/code> \u662f\u76f4\u63a5 Tailnet \u7ed1\u5b9a\uff08\u65e0 HTTPS\uff0c\u65e0 Serve\/Funnel\uff09\u3002<\/li>\n<li><code>gateway.bind: \"auto\"<\/code> \u4f18\u5148 loopback\uff1b\u5982\u679c\u4f60\u60f3\u8981\u4ec5 Tailnet\uff0c\u4f7f\u7528 <code>tailnet<\/code>\u3002<\/li>\n<li>Serve\/Funnel \u4ec5\u66b4\u9732 <strong>Gateway \u7f51\u5173 \u7f51\u5173\u63a7\u5236 UI + WS<\/strong>\u3002\u8282\u70b9\u901a\u8fc7\u76f8\u540c\u7684 Gateway \u7f51\u5173 \u7f51\u5173 WS \u7aef\u70b9\u8fde\u63a5\uff0c\u56e0\u6b64 Serve \u53ef\u4ee5\u7528\u4e8e\u8282\u70b9\u8bbf\u95ee\u3002<\/li>\n<\/ul>\n<h2>\u6d4f\u89c8\u5668\u63a7\u5236\uff08\u8fdc\u7a0b Gateway \u7f51\u5173 \u7f51\u5173 + \u672c\u5730\u6d4f\u89c8\u5668\uff09<\/h2>\n<p>\u5982\u679c\u4f60\u5728\u4e00\u53f0\u673a\u5668\u4e0a\u8fd0\u884c Gateway \u7f51\u5173 \u7f51\u5173\u4f46\u60f3\u5728\u53e6\u4e00\u53f0\u673a\u5668\u4e0a\u9a71\u52a8\u6d4f\u89c8\u5668\uff0c<br \/>\n\u5728\u6d4f\u89c8\u5668\u673a\u5668\u4e0a\u8fd0\u884c\u4e00\u4e2a<strong>\u8282\u70b9\u4e3b\u673a<\/strong>\u5e76\u8ba9\u4e24\u8005\u4fdd\u6301\u5728\u540c\u4e00\u4e2a tailnet \u4e0a\u3002<br \/>\nGateway \u7f51\u5173 \u7f51\u5173\u4f1a\u5c06\u6d4f\u89c8\u5668\u64cd\u4f5c\u4ee3\u7406\u5230\u8282\u70b9\uff1b\u4e0d\u9700\u8981\u5355\u72ec\u7684\u63a7\u5236\u670d\u52a1\u5668\u6216 Serve URL\u3002<\/p>\n<p>\u907f\u514d\u5c06 Funnel \u7528\u4e8e\u6d4f\u89c8\u5668\u63a7\u5236\uff1b\u5c06\u8282\u70b9\u914d\u5bf9\u89c6\u4e3a\u64cd\u4f5c\u8005\u8bbf\u95ee\u3002<\/p>\n<h2>Tailscale \u524d\u63d0\u6761\u4ef6 + \u9650\u5236<\/h2>\n<ul>\n<li>Serve \u9700\u8981\u4e3a\u4f60\u7684 tailnet \u542f\u7528 HTTPS\uff1b\u5982\u679c\u7f3a\u5c11\uff0cCLI \u4f1a\u63d0\u793a\u3002<\/li>\n<li>Serve \u6ce8\u5165 Tailscale \u8eab\u4efd\u5934\uff1bFunnel \u4e0d\u4f1a\u3002<\/li>\n<li>Funnel \u9700\u8981 Tailscale v1.38.3+\u3001MagicDNS\u3001\u542f\u7528 HTTPS \u548c funnel \u8282\u70b9\u5c5e\u6027\u3002<\/li>\n<li>Funnel \u4ec5\u652f\u6301\u901a\u8fc7 TLS \u7684\u7aef\u53e3 <code>443<\/code>\u3001<code>8443<\/code> \u548c <code>10000<\/code>\u3002<\/li>\n<li>macOS \u4e0a\u7684 Funnel \u9700\u8981\u5f00\u6e90 Tailscale \u5e94\u7528\u53d8\u4f53\u3002<\/li>\n<\/ul>\n<h2>\u4e86\u89e3\u66f4\u591a<\/h2>\n<ul>\n<li>Tailscale Serve \u6982\u8ff0\uff1a<a href=\"https:\/\/tailscale.com\/kb\/1312\/serve\">https:\/\/tailscale.com\/kb\/1312\/serve<\/a><\/li>\n<li><code>tailscale serve<\/code> \u547d\u4ee4\uff1a<a href=\"https:\/\/tailscale.com\/kb\/1242\/tailscale-serve\">https:\/\/tailscale.com\/kb\/1242\/tailscale-serve<\/a><\/li>\n<li>Tailscale Funnel \u6982\u8ff0\uff1a<a href=\"https:\/\/tailscale.com\/kb\/1223\/tailscale-funnel\">https:\/\/tailscale.com\/kb\/1223\/tailscale-funnel<\/a><\/li>\n<li><code>tailscale funnel<\/code> \u547d\u4ee4\uff1a<a href=\"https:\/\/tailscale.com\/kb\/1311\/tailscale-funnel\">https:\/\/tailscale.com\/kb\/1311\/tailscale-funnel<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Tailscale Tailscale\uff08Gateway \u7f51\u5173 \u7f51\u5173\u4eea\u8868\u76d8\uff09 OpenClaw \u53ef\u4ee5\u4e3a 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-142","post","type-post","status-publish","format-standard","hentry","category-docs"],"_links":{"self":[{"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts\/142","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=142"}],"version-history":[{"count":2,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts\/142\/revisions"}],"predecessor-version":[{"id":825,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts\/142\/revisions\/825"}],"wp:attachment":[{"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/media?parent=142"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/categories?post=142"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/tags?post=142"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}