Skip to content

PasteFerry (隔空贴): clipboard and file sync across macOS, Windows and Linux. Direct-first, end-to-end encrypted. Optional official access: no server to host. Independent self-hosting remains available.

21.3 KB
Raw Blame
<!doctype html>
<html lang="zh-CN">
<head>
  <meta charset="utf-8">
  <script>
    (function () {
      if (location.hostname !== "baiyuze.github.io") return;
      var prefix = /^\/(?:pasteferry|copysync)(?=\/|$)/.exec(location.pathname);
      if (!prefix) return;
      var path = location.pathname.slice(prefix[0].length) || "/";
      location.replace("https://pasteferry.cc" + path + location.search + location.hash);
    })();
  </script>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>用 Tailscale 跨网络使用隔空贴:不用服务器,在家和公司之间同步</title>
  <meta name="description" content="每台电脑装上 Tailscale、登录同一个账号,配对时输入对方的 Tailscale 地址:不需要公网 IP,不需要服务器,也不需要一直开着的电脑,在公司、在外面都能同步剪贴板。">
  <link rel="canonical" href="https://pasteferry.cc/tailscale/">
  <link rel="alternate" hreflang="zh-CN" href="https://pasteferry.cc/tailscale/">
  <link rel="alternate" hreflang="zh-TW" href="https://pasteferry.cc/zh-tw/tailscale/">
  <link rel="alternate" hreflang="zh-HK" href="https://pasteferry.cc/zh-hk/tailscale/">
  <link rel="alternate" hreflang="en" href="https://pasteferry.cc/en/tailscale/">
  <link rel="alternate" hreflang="ja" href="https://pasteferry.cc/ja/tailscale/">
  <meta name="theme-color" content="#141416">
  <meta property="og:type" content="article">
  <meta property="og:site_name" content="隔空贴">
  <meta property="og:title" content="用 Tailscale 跨网络使用隔空贴:不用服务器,在家和公司之间同步">
  <meta property="og:description" content="每台电脑装上 Tailscale、登录同一个账号,配对时输入对方的 Tailscale 地址:不需要公网 IP,不需要服务器,也不需要一直开着的电脑,在公司、在外面都能同步剪贴板。">
  <meta property="og:url" content="https://pasteferry.cc/tailscale/">
  <meta property="og:image" content="https://pasteferry.cc/assets/og.png">
  <meta property="og:locale" content="zh_CN">
  <meta name="twitter:card" content="summary_large_image">
  <link rel="icon" href="../assets/favicon.svg?v=df696024d8" type="image/svg+xml">
  <link rel="icon" href="../assets/favicon-32.png?v=8e9afa506d" sizes="32x32" type="image/png">
  <link rel="apple-touch-icon" href="../assets/apple-touch-icon.png?v=bcbf406cb8">
  <link rel="stylesheet" href="../assets/site.css?v=dbae55d27c">
  <script>document.documentElement.classList.add("js");if (!/Mac|iPhone|iPad/.test(navigator.platform || navigator.userAgent)) document.documentElement.classList.add("pc");</script>
</head>
<body>
  <a class="skip" href="#main">跳到正文</a>

  <header class="bar">
    <div class="wrap">
      <a class="brand" href=".././" aria-label="隔空贴首页"><img src="../assets/icon.svg?v=65a69999e0" alt="" width="26" height="26">隔空贴</a>
      <nav aria-label="页面导航">
        <a href="../features/">功能</a>
        <a class="mid" href="../start/">快速开始</a>
        <a class="wide" href="../start/#server" aria-current="true">连接方式</a>
        <a href="../download/">下载</a>
        <details class="menu">
          <summary aria-label="更多页面"><span>更多</span><svg class="chev" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m3 4.5 3 3 3-3"/></svg></summary>
          <ul>
            <li class="narrow"><a href="../start/">快速开始</a></li>
            <li class="narrow"><a href="../start/#server">连接方式</a></li>
            <li><a href="../themes/">主题教程</a></li>
            <li><a href="../how/">工作原理</a></li>
            <li><a href="../security/">安全与隐私</a></li>
            <li><a href="../faq/">常见问题</a></li>
            <li><a href="../feedback/">讨论与反馈</a></li>
            <li class="sep" role="separator"></li>
            <li><a href="https://github.com/baiyuze/pasteferry/blob/main/CHANGELOG.md">更新记录</a></li>
            <li class="narrow-gh"><a href="https://github.com/baiyuze/pasteferry">GitHub</a></li>
          </ul>
        </details>
        <a class="gh" href="https://github.com/baiyuze/pasteferry" data-gh-stars aria-label="在 GitHub 上给隔空贴点 Star"><svg class="gh-mark" viewBox="0 0 16 16" aria-hidden="true"><path fill="currentColor" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"/></svg><span class="gh-label">Star</span><span class="gh-count" hidden><svg class="gh-star" viewBox="0 0 16 16" aria-hidden="true"><path fill="currentColor" d="M8 .25a.75.75 0 01.673.418l1.882 3.815 4.21.612a.75.75 0 01.416 1.279l-3.046 2.97.719 4.192a.751.751 0 01-1.088.791L8 12.347l-3.766 1.98a.75.75 0 01-1.088-.79l.72-4.194L.818 6.374a.75.75 0 01.416-1.28l4.21-.611L7.327.668A.75.75 0 018 .25z"/></svg><b></b></span></a>
        <details class="lang">
          <summary aria-label="语言:简体中文"><svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.4" aria-hidden="true"><circle cx="10" cy="10" r="7.25"/><path d="M2.75 10h14.5M10 2.75c-2.1 2-3.1 4.4-3.1 7.25s1 5.25 3.1 7.25M10 2.75c2.1 2 3.1 4.4 3.1 7.25s-1 5.25-3.1 7.25"/></svg><span>简体中文</span><svg class="chev" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m3 4.5 3 3 3-3"/></svg></summary>
          <ul>
            <li><a href="../tailscale/" hreflang="zh-CN" lang="zh-CN" data-lang="zh" aria-current="page">简体中文</a></li>
            <li><a href="../zh-tw/tailscale/" hreflang="zh-TW" lang="zh-TW" data-lang="zh-tw">繁體中文(台灣)</a></li>
            <li><a href="../zh-hk/tailscale/" hreflang="zh-HK" lang="zh-HK" data-lang="zh-hk">繁體中文(香港)</a></li>
            <li><a href="../en/tailscale/" hreflang="en" lang="en" data-lang="en">English</a></li>
            <li><a href="../ja/tailscale/" hreflang="ja" lang="ja" data-lang="ja">日本語</a></li>
          </ul>
        </details>
      </nav>
    </div>
  </header>

  <main id="main">
    <section class="hero guide-hero">
      <div class="wrap">
        <p class="crumb"><a href=".././">隔空贴</a> / <a href="../start/#server">连接方式</a></p>
        <h1 class="display">用 Tailscale 跨网络使用</h1>
        <p class="lede">没有公网 IP,也不想部署服务器?每台电脑装上 Tailscale,配对时输入对方的 Tailscale 地址,在家、在公司都能同步。</p>
        <ol class="guide-toc">
          <li><a href="#join">装 Tailscale</a></li>
          <li><a href="#address">查地址</a></li>
          <li><a href="#pair">配对</a></li>
          <li><a href="#faq">常见问题</a></li>
        </ol>
      </div>
    </section>

    <section class="section" id="overview" aria-labelledby="overview-title">
      <div class="wrap">
        <h2 id="overview-title">像在同一个局域网里</h2>
        <p class="intro">Tailscale 是一个组网工具:装了它、登录同一个账号的设备,各自分到一个固定的 100 开头的地址,不管实际在哪个网络里,都能用这个地址互相访问。隔空贴配对时记住对方的这个地址,之后就像在同一个网络里一样直接连接。</p>
        <figure class="diagram">
          <svg viewBox="0 0 960 330" role="img" aria-labelledby="ts-title ts-desc">
            <title id="ts-title">通过 Tailscale 使用隔空贴</title>
            <desc id="ts-desc">Mac 在公司,Windows 在家里,两台都装了 Tailscale,在同一个虚拟局域网里各有一个 100 开头的地址。复制的内容在两台电脑之间直接传输,没有服务器。</desc>
            <rect class="d-ts" x="8" y="8" width="944" height="314" rx="22"/>
            <text class="d-ts-label" x="32" y="42">Tailscale 虚拟局域网:每台设备一个 100 开头的地址</text>
            <rect class="d-box" x="40" y="100" width="240" height="160" rx="14"/>
            <text class="d-title" x="160" y="146" text-anchor="middle">Mac</text>
            <text class="d-sub" x="160" y="174" text-anchor="middle">在公司</text>
            <text class="d-ip" x="160" y="226" text-anchor="middle">100.88.20.5</text>
            <rect class="d-box" x="680" y="100" width="240" height="160" rx="14"/>
            <text class="d-title" x="800" y="146" text-anchor="middle">Windows</text>
            <text class="d-sub" x="800" y="174" text-anchor="middle">在家里</text>
            <text class="d-ip" x="800" y="226" text-anchor="middle">100.92.41.17</text>
            <path class="d-direct" d="M280 190H680"/>
            <text class="d-label" x="480" y="176" text-anchor="middle">直连,两层加密</text>
            <text class="d-note" x="480" y="218" text-anchor="middle">复制的内容只在两台电脑之间传输</text>
          </svg>
        </figure>
        <ul class="points ports">
          <li><strong>不需要服务器,</strong>也不需要一直开着的电脑:两台电脑开着、连着 Tailscale,就能同步。</li>
          <li><strong>地址只输入一次。</strong>Tailscale 地址不会变,配对时输入一次,之后两台会自动找到彼此。</li>
          <li><strong>两层加密。</strong>Tailscale 的 WireGuard 隧道里,跑的是隔空贴自己端到端加密的连接,Tailscale 看不到内容。</li>
        </ul>
      </div>
    </section>

    <section class="section" id="prepare" aria-labelledby="prepare-title">
      <div class="wrap">
        <h2 id="prepare-title">开始之前</h2>
        <dl class="fallbacks">
          <div><dt>一个 Tailscale 账号</dt><dd>个人使用免费,用 Google、Microsoft、GitHub 或 Apple 账号就能登录。所有设备登录同一个账号。</dd></div>
          <div><dt>每台电脑都装 Tailscale</dt><dd>Windows、macOS、Linux 都有客户端。用隔空贴的电脑都要装,并保持连接。</dd></div>
          <div><dt>隔空贴已经装好</dt><dd>每台电脑装好 App、启用了后台同步,见<a href="../start/#app">快速开始</a>。服务器地址留空就行。</dd></div>
          <div><dt>用 ZeroTier 也行</dt><dd>其他能给每台设备分配固定虚拟地址的组网工具,做法相同:配对时输入它分配的地址。下面以 Tailscale 为例。</dd></div>
        </dl>
      </div>
    </section>

    <section class="section" id="join" aria-labelledby="join-title">
      <div class="wrap">
        <p class="eyebrow">第 1 步</p>
        <h2 id="join-title">在每台电脑上装 Tailscale</h2>
        <p class="intro">每台要同步的电脑,都装上并登录同一个账号。</p>
        <div class="os-grid qs-grid">
          <div class="os-steps">
            <ol class="steps">
              <li>到 Tailscale 官网下载对应系统的客户端并安装。<span class="aside">Linux 上运行 <code>curl -fsSL https://tailscale.com/install.sh | sh</code>,再运行 <code>sudo tailscale up</code>,打开它给出的链接登录。</span></li>
              <li>打开 Tailscale,登录。每台电脑都用同一个账号。</li>
              <li>登录后,在 Tailscale 的管理后台能看到所有设备,每台都有一个 100 开头的地址。</li>
            </ol>
            <a class="button" href="https://tailscale.com/download"><svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 3v10m0 0-4-4m4 4 4-4M4 16h12"/></svg>下载 Tailscale</a>
          </div>
          <div class="os-figures">
            <figure class="browser listing" role="img" aria-label="Tailscale 管理后台的设备列表(示意):macbook-pro 的地址是 100.88.20.5,home-pc 是 100.92.41.17">
              <div class="b-bar"><span class="t-lights" aria-hidden="true"><i></i><i></i><i></i></span><span class="b-url">login.tailscale.com/admin/machines</span></div>
              <table>
                <thead><tr><th scope="col">设备</th><th scope="col">Tailscale 地址</th><th scope="col">系统</th></tr></thead>
                <tbody>
                <tr><td>macbook-pro</td><td>100.88.20.5</td><td>macOS</td></tr>
                <tr><td>home-pc</td><td>100.92.41.17</td><td>Windows</td></tr>
                </tbody>
              </table>
            </figure>
          </div>
        </div>
        <div class="server-notes">
          <h3>让 Tailscale 一直连着</h3>
          <ul class="points">
            <li><strong>Windows:</strong>在任务栏右下角的 Tailscale 图标上右键,在「Preferences」里勾选「Run unattended」,注销之后也保持连接。</li>
            <li><strong>Mac:</strong>确认 Tailscale 登录后会自动打开。</li>
            <li><strong>关掉密钥过期:</strong>Tailscale 默认每 180 天要求设备重新登录一次。常年不动的电脑,可以在管理后台的 Machines 页面,点那一行最右边的菜单,选「Disable key expiry」。</li>
          </ul>
        </div>
      </div>
    </section>

    <section class="section" id="address" aria-labelledby="address-title">
      <div class="wrap">
        <p class="eyebrow">第 2 步</p>
        <h2 id="address-title">查对方的 Tailscale 地址</h2>
        <p class="intro">在要配对的另一台电脑上点 Tailscale 的图标(Mac 在菜单栏,Windows 在任务栏右下角),菜单里能看到本机的地址;或者在终端里运行 <code>tailscale ip -4</code>。</p>
        <div class="address-term">
          <figure class="term" role="img" aria-label="在 PowerShell 里运行 tailscale ip -4,输出本机的 Tailscale 地址 100.92.41.17">
                <div class="t-bar mac"><span class="t-lights" aria-hidden="true"><i></i><i></i><i></i></span><span class="t-title">home-pc — PowerShell</span></div>
<pre class="t-body"><span class="t-prompt">&gt;</span> tailscale ip -4
<span class="t-url">100.92.41.17</span></pre>
              </figure>
        </div>
        <p class="note">下面以家里那台 Windows 的 <code>100.92.41.17</code> 为例,换成你的地址。</p>
      </div>
    </section>

    <section class="section" id="pair" aria-labelledby="pair-title">
      <div class="wrap">
        <p class="eyebrow">第 3 步</p>
        <h2 id="pair-title">配对时输入这个地址</h2>
        <p class="intro">和在同一网络里配对一样,只是多输入一个地址。</p>
        <div class="os-grid qs-grid">
          <div>
            <ol class="steps">
              <li>在家里那台 Windows 上打开「设备」,点「添加设备」,记下 6 位配对码。</li>
              <li>在公司的 Mac 上点「添加设备」,切到「输入配对码」,输入它;再点「不在同一网段?」,填上 <code>100.92.41.17</code>,点「继续」。</li>
              <li>两块屏幕会显示同样的两行安全指纹,逐字核对一致后确认。之后两台在哪儿都能同步。</li>
            </ol>
          </div>
          <figure class="shot">
            <img src="../assets/screenshots/pairing-join-ts-dark.png?v=c772c1f42e" width="2112" height="1472" loading="lazy" alt="输入配对码:填好配对码 K7MP2X,地址框里填着 Tailscale 地址 100.92.41.17">
          </figure>
        </div>
        <p class="note">两台都在家里时,隔空贴也会在局域网里直接找到对方,数据不会绕道。</p>
      </div>
    </section>

    <section class="section" id="faq" aria-labelledby="faq-title">
      <div class="wrap">
        <h2 id="faq-title">常见问题</h2>
        <div class="faq">
          <details>
            <summary>设备之间显示「直连」,速度却很慢?</summary>
            <div class="answer"><p>隔空贴显示的「直连」,指两台电脑在 Tailscale 的虚拟网里直接相连。Tailscale 自己打不通两台电脑时,会经它在境外的中转服务器(DERP)转发,在国内用就会慢。</p><p>在终端里运行 <code>tailscale ping 对方的地址</code>:显示 via DERP,说明 Tailscale 在中转;显示 via 一个 IP 和端口,就是点对点。公司网络、校园网比较容易遇到中转,可以自建 DERP 中转服务器,或者换一种组网工具。</p></div>
          </details>
          <details>
            <summary>配对时找不到对方?</summary>
            <div class="answer"><p>先确认两台的 Tailscale 都已连接:在终端里运行 <code>tailscale ping 对方的地址</code>,能 ping 通再试。</p><p>能 ping 通还找不到,多半是对方的防火墙挡住了:对方是 Windows 的话,在它的隔空贴「设置 → 连接」里点「放行」;是 Mac 的话,确认「系统设置 → 隐私与安全性 → 本地网络」里打开了 PasteFerry Daemon。</p></div>
          </details>
          <details>
            <summary>一定要每台电脑都装 Tailscale 吗?</summary>
            <div class="answer"><p>是的,没装的电脑访问不到 100 开头的地址。两台在同一个网络里时,不装也能用,见<a href="../lan/">同一网络教程</a>。</p></div>
          </details>
          <details>
            <summary>以前照教程在家里装过服务器,还要它吗?</summary>
            <div class="answer"><p>不需要了。在每台电脑的「设置 → 连接」里清空服务器地址,再在家里那台电脑上卸载服务器即可,已经配对的设备不用重新配对。留着也没关系,服务器和 Tailscale 可以同时用。</p></div>
          </details>
          <details>
            <summary>Tailscale 能看到我复制的内容吗?</summary>
            <div class="answer"><p>不能。Tailscale 的连接用 WireGuard 端到端加密,里面跑的又是隔空贴自己的 DTLS 加密连接,两层都只有两台电脑能解开。Tailscale 的服务器只交换设备的公钥和地址,中转服务器也只转发加密后的数据包。</p></div>
          </details>
          <details>
            <summary>Tailscale 地址会变吗?</summary>
            <div class="answer"><p>一般不会。地址跟着设备走,重启、换网络都不变;只有把设备从 Tailscale 里删掉再重新加入,才会换一个。换了的话,在「设备」里给那台设备重新输入一次地址。</p></div>
          </details>
          <details>
            <summary>我有公网服务器,还需要 Tailscale 吗?</summary>
            <div class="answer"><p>不需要。把服务器部署在有公网 IP 的机器上,所有电脑填它的地址就行,见<a href="../cloud/">公网服务器部署教程</a>。</p></div>
          </details>
        </div>
      </div>
    </section>

    <section class="closing" aria-labelledby="closing-title">
      <div class="wrap">
        <h2 class="display" id="closing-title">不用服务器,<br>复制跟着你走。</h2>
        <div class="cta">
          <a class="button" href="../download/"><svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 3v10m0 0-4-4m4 4 4-4M4 16h12"/></svg>下载隔空贴</a>
        </div>
        <p class="note">版本 2.10.1,免费开源。macOS 13 及以上;Windows 10、11;Linux(x64 与 ARM64)。 支持安卓 9 及以上;手机可扫码用网页。</p>
        <a class="source" href="../lan/">回到同一网络教程</a>
      </div>
    </section>
  </main>

  <footer class="footer">
    <div class="wrap">
      <p>隔空贴以 GNU AGPL-3.0 开源。</p>
      <nav aria-label="页脚链接">
        <a href="https://github.com/baiyuze/pasteferry/releases">所有版本</a>
        <a href="https://github.com/baiyuze/pasteferry/blob/main/CHANGELOG.md">更新记录</a>
        <a href="https://pasteferry.cc/design/nat-traversal.html">技术方案</a>
        <a href="https://github.com/baiyuze/pasteferry/blob/main/LICENSING.md">许可说明</a>
        <a href="https://github.com/baiyuze/pasteferry/issues">反馈问题</a>
        <a href="../privacy/">隐私说明</a>
        <a href="../feedback/">讨论与反馈</a>
      </nav>
      <nav aria-label="语言">
        <a href="../tailscale/" hreflang="zh-CN" lang="zh-CN" data-lang="zh" aria-current="page">简体中文</a>
        <a href="../zh-tw/tailscale/" hreflang="zh-TW" lang="zh-TW" data-lang="zh-tw">繁體中文(台灣)</a>
        <a href="../zh-hk/tailscale/" hreflang="zh-HK" lang="zh-HK" data-lang="zh-hk">繁體中文(香港)</a>
        <a href="../en/tailscale/" hreflang="en" lang="en" data-lang="en">English</a>
        <a href="../ja/tailscale/" hreflang="ja" lang="ja" data-lang="ja">日本語</a>
      </nav>
    </div>
  </footer>

  <script src="../assets/site.js?v=fb60f6e5ce" defer></script>
  <script src="/assets/analytics.js?v=e2777f714d" defer></script>
  <script type="module" src="https://static.cloudflareinsights.com/beacon.min.js" data-cf-beacon='{"token": "7ee226baf4a949a397c4bfd69a9e7461"}'></script>
</body>
</html>