Tailscale 组网教程:Mac 访问 Windows / Linux

用 Tailscale 把 Mac、Windows、Linux 组成虚拟局域网,无需自建新加坡 VPS,安装客户端即可互访。 文档更新:2026-05-29


一、方案说明

Tailscale 基于 WireGuard,自动处理 NAT 穿透和设备发现。Mac 和 Windows 优先 P2P 直连,连不上时走 Tailscale 中继,仍可互通。

  ┌─────────────┐         ┌─────────────┐
  │    Mac      │◄──P2P──►│   Windows   │
  │ 100.x.x.x   │  或中继  │ 100.x.x.x   │
  └──────┬──────┘         └──────┬──────┘
         │                       │
         └───────────┬───────────┘
                     │
              Tailscale 协调服务器
              (仅密钥交换,不读业务流量)

不需要新加坡服务器。 仅 Mac ↔ Windows 互访时,两端装客户端、同一账号登录即可。

项目 说明
免费额度 100 台设备、3 个用户
Mac macOS 11+
Windows Windows 10/11
Linux Ubuntu / Debian 等
账号 Google / Microsoft / GitHub / Apple 等

二、注册 Tailnet

  1. 打开 https://login.tailscale.com/start
  2. 用 Google / Microsoft / GitHub 等登录
  3. 进入管理后台:https://login.tailscale.com/admin/machines
  4. 打开 DNS 设置,确认 MagicDNS 已开启:https://login.tailscale.com/admin/dns

三、Mac 安装

安装

brew install --cask tailscale

或官网下载:https://tailscale.com/download/macos

登录

  1. 打开 Tailscale(菜单栏图标)
  2. 点击 Log in,浏览器完成授权
  3. 状态变为 Connected

验证

tailscale status
tailscale ip -4

四、Windows 安装

  1. 下载:https://tailscale.com/download/windows
  2. 安装并打开 Tailscale
  3. 使用与 Mac 相同的账号 登录
  4. 确认状态为 Connected

开启远程桌面(供 Mac RDP 连接)

  • 设置 → 系统 → 远程桌面 → 启用
  • 防火墙允许远程桌面(专用网络即可,Tailscale 接口一般为专用网络)

PowerShell 检查:

Get-NetFirewallRule -DisplayGroup "Remote Desktop" | Select DisplayName, Enabled

查看 Windows 的 Tailscale 信息

系统托盘 Tailscale → 点击机器名,可看到 100.x.y.zMagicDNS 名称(如 desktop-abc123)。


五、Linux / Ubuntu 安装

适用于 VirtualBox 虚拟机、云服务器等。

# 安装
curl -fsSL https://tailscale.com/install.sh | sh

# 登录并加入 Tailnet(会输出浏览器授权链接)
sudo tailscale up

验证:

tailscale status
tailscale ip -4

Mac SSH 连接 Ubuntu 示例

# 先查 Ubuntu 的 Tailscale IP
tailscale status

# SSH 连接(示例 IP,以 tailscale status 为准)
ssh user@100.x.y.z

六、Mac 远程桌面连接 Windows

方式 A:MagicDNS(推荐)

  1. Mac 安装 Microsoft Remote Desktop(App Store)
  2. 添加 PC:
    • PC name:Windows 在 Tailscale 里显示的主机名,如 desktop-abc123
    • 或完整域名:desktop-abc123.your-tailnet.ts.net
  3. 填入 Windows 用户名和密码 → 连接

方式 B:Tailscale IP

PC name 填 Windows 的 100.x.y.z(Mac 上 tailscale status 可见)。

连通性测试

# 查看所有在线设备
tailscale status

# ping Windows(HOST 换成 MagicDNS 名或 100.x.y.z)
ping desktop-abc123

# 测试 RDP 端口
nc -zv 100.x.y.z 3389

七、操作检查清单

按顺序勾选,约 10~15 分钟完成。

准备

  • 注册 Tailscale 账号
  • MagicDNS 已开启

Mac

  • 安装 Tailscale
  • 登录(与 Windows / Linux 同一账号)
  • 状态 Connected
  • tailscale status 能看到其他设备

Windows

  • 安装 Tailscale,同一账号登录
  • 开启远程桌面
  • 防火墙允许 RDP(专用网络)
  • 记下 MagicDNS 名或 100.x.y.z

Linux(可选)

  • curl -fsSL https://tailscale.com/install.sh | sh
  • sudo tailscale up 完成授权
  • Mac 能 ssh user@100.x.y.z

连接测试

  • Mac:ping <windows-hostname>
  • Mac:nc -zv <windows-ip> 3389
  • Microsoft Remote Desktop 连接成功

完成标志:Mac 通过 Tailscale IP 或 MagicDNS 名成功 RDP 到 Windows。


八、常见问题

Mac 看不到 Windows / ping 不通

  1. 两端是否 同一 Tailscale 账号 且均为 Connected
  2. Mac 执行 tailscale status,Windows 是否在列表中
  3. 若显示 relay,说明经中继连接,仍可通但延迟略高
  4. 检查 Windows 防火墙是否放行 RDP

能 ping 通但 RDP 失败

  • Windows 远程桌面是否已开启
  • 用户名格式:电脑名\用户名 或 Microsoft 账号
  • 执行 nc -zv 100.x.y.z 3389 确认端口通

国内连接 Tailscale 不稳定

  • 换网络重试(手机热点 / 不同宽带)
  • 多试几次 sudo tailscale up 或重启 Tailscale 客户端

更换设备或重装系统

新设备用同一账号登录即可;旧设备可在 Admin Console 删除。


九、常用命令速查

操作 命令
查看设备列表 tailscale status
查看本机 IP tailscale ip -4
Linux 登录 sudo tailscale up
Linux 断开 sudo tailscale down
ping 对端 ping <hostname>ping 100.x.y.z
测 RDP 端口 nc -zv 100.x.y.z 3389
SSH 连 Linux ssh user@100.x.y.z

十、安全建议


十一、相关链接

用途 链接
注册 https://login.tailscale.com/start
设备管理 https://login.tailscale.com/admin/machines
DNS / MagicDNS https://login.tailscale.com/admin/dns
Mac 下载 https://tailscale.com/download/macos
Windows 下载 https://tailscale.com/download/windows
Linux 安装脚本 https://tailscale.com/download/linux