mcpField
T
tailscale

tailscale

github.com/tailscale云与 DevOps441.0k 次安装16 周前更新
代码仓库

关于 tailscale

Tailscale 技能汇集其安全组网产品的说明与操作参考,面向需要配置或排查设备网络、访问控制和企业基础设施的用户。它按任务组织文档,并区分操作命令指南与需要查阅最新文档的主题。

主要功能

  1. 01解释 tailnet、WireGuard 和 MagicDNS
  2. 02按任务索引网络与连接主题
  3. 03提供访问策略编写指导
  4. 04涵盖容器、企业网络和设备管理
  5. 05区分命令操作与说明性参考

适用场景

  1. 01配置设备间的私有网络访问
  2. 02为 tailnet 编写访问规则
  3. 03排查连接、DNS 或 Kubernetes 问题
  4. 04规划 Agent 对网络工具和数据的访问

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/tailscale/tailscale-skill --skill tailscale

安装后在 Claude Code 中输入/tailscale确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

references/
access-control.md
aperture.md
api.md
border0.md
cli.md
common-tasks.md
connectivity.md
containers.md
device-management.md
enterprise.md
error-messages.md
exit-nodes.md
installation.md
session-recording.md
sharing-and-publishing.md
subnet-routers.md
tsnet.md

详细介绍

Tailscale

Tailscale 是一款零配置网状 VPN,可在你的设备之间建立安全的点对点网络(称为 tailnet)。它使用 WireGuard 加密,并让设备直接连接,而不是经由中央网关转发。

除了核心 VPN 功能外,Tailscale 还提供一系列基于相同身份与网络层构建的产品。本技能涵盖所有这些产品——请根据相关主题查阅参考文件。

参考文件的使用方式

根据技能需要为用户完成的任务,参考文件分为两种类型。

描述型参考文件(大多数文件——aperture.md、containers.md、enterprise.md、device-management.md、session-recording.md、api.md、tsnet.md)用于帮助你向用户介绍某个主题:解释相关内容、起草配置或推荐方案。这些文件采用混合布局——在文件内提供稳定的概念模型和关键配置形式,同时整理了规范的 tailscale.com/docs/... URL,供你使用 WebFetch 获取最新详情。请遵循文件内关于何时获取内容的说明。如果 WebFetch 可用,查询具体信息(配置项、环境变量、支持的模型、定价)时优先使用实时页面,而不是文件内的摘要。如果 WebFetch 不可用,请根据文件内的内容作答,并告知用户应查阅哪个文档页面。

操作型参考文件(目前只有 cli.md)用于帮助你在用户的机器上操作工具——Claude 会实际调用命令。由于错误的标志会导致真实系统出问题,这类文件会在文件内保留具体的命令和标志。备用方案是本地验证,而非访问网络:建议使用某个标志前,运行 tailscale help <subcommand> 进行确认。若未安装该工具,规范文档 URL 是第二备用方案。

其余参考文件(access-control.md、common-tasks.md、connectivity.md、exit-nodes.md、installation.md、subnet-routers.md)篇幅较短且内容独立——阅读文件并回答问题即可。

核心概念

  • Tailnet:由经过身份验证的设备和用户组成的专用网络。
  • WireGuard:Tailscale 底层使用的加密协议。密钥管理会自动完成。
  • MagicDNS:为每台设备自动分配 DNS 名称(例如,ssh my-server)。
  • 100.x.y.z 地址:每台设备都会获得一个稳定的 Tailscale IP,位于 CGNAT 地址范围内。
  • Tailnet 策略文件:管理控制台中的 JSON 配置,用于定义访问控制、组、标签和 SSH 规则。默认拒绝访问。

编写默认规则

用户要求你编写或编辑 tailnet 策略文件时:

  • 使用 grants,而非 ACL。 Grants 是 Tailscale 推荐的访问规则表达方式。Grants 涵盖 ACL 所支持的内容(网络层访问),也能通过一种形式支持应用层功能(Kubernetes、Aperture、tsrecorder、Taildrive)。ACL 仍受支持,可用于读取现有策略和迁移,但你编写的每条新访问规则都应使用 grant。有关转换方式,请参阅 references/access-control.md;规范对比请见 https://tailscale.com/docs/reference/grants-vs-acls。
  • grant 与 ACL 的选择仅适用于访问规则。 策略文件的其他部分各有专用语法,并非 grants:"ssh"(SSH 访问)、"autoApprovers"(自动批准通告路由和出口节点)、"nodeAttrs"(节点级属性,例如 Funnel)、"postures"(设备姿态定义,可通过 grants 中的 srcPosture 引用),以及 "groups"/"tagOwners" 定义。

快速开始

对于 macOS/Windows,请从 https://tailscale.com/download 下载 Tailscale。

对于 iOS、iPadOS、tvOS、Android 设备、Roku 设备和 Fire TV,请通过平台的应用商店安装 Tailscale。

在 Linux 设备上使用安装脚本安装 Tailscale:

curl -fsSL https://tailscale.com/install.sh | sh   # Install (Linux)
sudo tailscale up                                    # Connect
tailscale status                                     # Verify

使用 Tailscale 进行身份验证时,请将用户设备关联到用户帐户。使用标签和身份验证密钥,将服务器和非用户设备添加到 tailnet。

查找你的任务

“我想通过个人笔记本电脑或手机访问工作用设备”
Need remote access to work?
├─ My work computers or internal apps → references/common-tasks.md
├─ Remote desktop into my work machine (RDP, VNC) → references/connectivity.md
├─ Replace our old company VPN → references/enterprise.md
└─ A device that can't run Tailscale (printer, camera, cloud VPC) → references/subnet-routers.md
“我在旅行,想让自己的网络使用体验和在家时一样”
Traveling or on Wi-Fi you don't trust?
├─ Protect my traffic on hotel, cafe, or airport Wi-Fi → references/exit-nodes.md
├─ Use my home country's sites and streaming while abroad → references/exit-nodes.md
└─ Set up an exit node for family (the one you mail your parents) → references/exit-nodes.md
“我想仅在需要时才让他人访问我们的服务器,并审计他们的操作”
Need to lock down access?
├─ Access only when it's needed, not standing admin rights → references/access-control.md
├─ A break-glass path for emergencies → references/access-control.md
├─ Record SSH or kubectl sessions → references/session-recording.md
├─ Govern privileged access to servers, databases, and clusters (PAM) → references/border0.md
└─ Reach the Kubernetes API server → references/containers.md
“我想让服务和设备跨网络安全地连接”
Need machines talking to each other?
├─ A CI/CD pipeline that reaches private infra → references/enterprise.md
├─ Kubernetes workloads across clusters or clouds → references/containers.md
├─ Services across more than one cloud → references/enterprise.md
├─ Thousands of field devices (fleets, vehicles, robots) → references/device-management.md
├─ Fix overlapping IPs across sites → references/subnet-routers.md
└─ Link two office networks together (site-to-site) → references/subnet-routers.md
“我想与他人共享我设备上的文件或应用”
Need to share or open something up?
├─ Send a file to someone's device → references/sharing-and-publishing.md (Taildrop)
├─ Keep a folder synced across my devices → references/sharing-and-publishing.md (Taildrive)
├─ Let a teammate reach an app on my laptop → references/sharing-and-publishing.md (Serve)
└─ Put an app on the public internet → references/sharing-and-publishing.md (Funnel)
“我正在测试应用,需要让它访问其他位置,或看起来像是位于其他位置”
Testing an app?
├─ Preview a local dev server with teammates or the internet → references/sharing-and-publishing.md
├─ Remote into a desktop (RDP, VNC, RustDesk) → references/connectivity.md
└─ Make test traffic appear to come from another country → references/exit-nodes.md
“有东西出故障了,或者我看到了错误消息”
Hit an error or something not working?
├─ A specific error or status message (in the app or admin console) → references/error-messages.md
├─ Devices can't connect, slow/relayed, or DNS/NAT problems → references/connectivity.md
├─ A grant or access rule isn't behaving → references/access-control.md
└─ Kubernetes operator problems → references/containers.md
“我想运行自己的 LLM,并确保其私密性”
Running your own AI?
├─ Reach my home model (Ollama, LM Studio) from my other devices → references/installation.md
├─ Put my home GPU on my tailnet for inference → references/tsnet.md
└─ Open my private chat UI or RAG to just my devices → references/sharing-and-publishing.md (Serve)
“我想控制公司 AI 工具的费用及其可访问的内容”
Governing how your company uses AI?
├─ Centralize and rotate our LLM API keys → references/aperture.md
├─ See cost and usage per person or team → references/aperture.md
├─ Put quotas or budgets on AI spend → references/aperture.md
└─ Control which MCP tools agents are allowed to use → references/aperture.md
“我想为 AI agent 提供安全身份,以便其访问工具”
Securing AI agents?
├─ Give each agent its own identity on the network → references/tsnet.md
├─ Let agents reach each other across machines → references/tsnet.md
├─ Control exactly which tools and data an agent can reach → references/access-control.md
└─ Fence an agent off so it can only touch what I allow → references/access-control.md
“我想在外出时访问家用电脑、文件和媒体”
Need to reach home?
├─ Home computers and files → references/installation.md
├─ A headless Pi or home server, with no port forwarding → references/subnet-routers.md
├─ Media or backups (Jellyfin, *arr, Nextcloud) → references/sharing-and-publishing.md
├─ Smart-home gear (Home Assistant, Pi-hole) → references/subnet-routers.md
└─ Remote desktop or game streaming (Moonlight, RDP) → references/connectivity.md
“我想通过公司的电子邮件或 SSO 安全连接公司设备”
Need everyone connected through SSO?
├─ Provision users from our identity provider (SSO, SCIM) → references/device-management.md
├─ Push Tailscale to managed devices (Jamf, Intune) → references/device-management.md
├─ Require posture or approval before connecting → references/device-management.md
└─ Automate nodes (auth keys, ephemeral nodes, Terraform) → references/enterprise.md
“我正在构建一个需要安全访问私有资源的应用”
Building it into your app?
├─ My service needs to reach a private database or API → references/tsnet.md
├─ Give my app its own identity, separate from the host → references/tsnet.md
└─ Serve or publish my app straight from code → references/tsnet.md

主题索引

请阅读与用户问题相匹配的参考文件。每个文件都是独立完整的。

网络与连接
主题参考文件阅读时机
安装references/installation.md在任何平台上安装 Tailscale、更新或卸载
出口节点references/exit-nodes.md通过某台设备路由所有互联网流量(类似 VPN)、旅行安全
子网路由器references/subnet-routers.md访问无法运行 Tailscale 的设备(打印机、摄像头、云 VPC)
访问控制references/access-control.md授权规则、ACL、标签、组、策略文件结构
连接references/connectivity.md对等中继、DERP 服务、NAT 穿透、tailnet 锁、连接类型
常见任务references/common-tasks.mdTailscale SSH、MagicDNS、身份验证密钥、密钥过期
共享与发布
主题参考文件阅读时机
共享与发布references/sharing-and-publishing.mdTaildrop(文件传输)、Taildrive(持久文件夹共享)、Tailscale Serve(私有)、Tailscale Funnel(公开)
容器与编排
主题参考文件阅读时机
Docker 与 Kubernetesreferences/containers.md在 Docker 容器中运行 Tailscale、边车模式、Docker Compose、Kubernetes operator、集群入口/出口、Connector CRD、ProxyGroup
企业与基础设施
主题参考文件阅读时机
企业模式references/enterprise.md替代 VPN、基础设施访问、临时节点、CI/CD 集成(GitHub Actions)、站点到站点网络、应用连接器、自动化用身份验证密钥、Terraform provider
设备管理references/device-management.md设备审批、设备状态、MDM 部署、通过 SCIM 配置用户/组、批量设备操作、企业推广
会话录制references/session-recording.mdtsrecorder 设置、SSH 会话录制、S3 存储、Kubernetes kubectl 录制、API 请求录制、故障转移、审计合规
Border0(PAM)references/border0.md特权访问管理、应用感知访问、即时访问、SSH/Kubernetes/RDP/VNC/数据库会话录制、连接器和套接字、消除凭据
基于 Tailscale 构建
主题参考文件何时阅读
tsnet(Go 库)references/tsnet.md使用内置 Tailscale 的 Go 应用构建,让应用本身成为 tailnet 上的一台设备;通过 Tailscale 身份验证用户身份且无需单独登录流程的应用;通过策略文件中管理的标签和能力授权来控制访问的应用;在同一台主机上运行多个此类应用,每个应用都有自己的身份和访问规则;使用 Go 访问或提供 tailnet 私有服务,且不向公网暴露任何内容
AI 与大模型治理
主题参考文件何时阅读
Aperturereferences/aperture.mdAI 网关、大模型请求路由、API 密钥集中管理、用量可见性、成本控制、配额、编码 Agent 集成、MCP 代理
参考
主题参考文件何时阅读
CLIreferences/cli.mdTailscale CLI 命令、标志、serve/funnel、文件传输、诊断、tailnet lock
APIreferences/api.mdTailscale REST API、身份验证、设备管理、DNS、策略文件、webhook
错误与状态消息references/error-messages.md查询特定的客户端或管理控制台错误/状态消息(DERP 中继、DNS、SSH/SELinux、Docker、Windows、SSO、账单)及其修复方法

CLI 快速参考

命令功能
tailscale up连接到你的 tailnet
tailscale down断开连接
tailscale status显示已连接的设备
tailscale ip显示你的 Tailscale IP 地址
tailscale ping <host>测试与设备的连接
tailscale set --ssh在此设备上启用 Tailscale SSH
tailscale set --advertise-exit-node将此设备声明为出口节点
tailscale set --exit-node=<ip>使用指定的出口节点
tailscale set --advertise-routes=<cidr>声明子网路由
tailscale set --accept-routes接受已声明的子网路由(Linux)

评论

支持 Markdown