tailscale
Tailscaleは、離れた場所にある機器同士を安全に繋いだり、社内システムへのアクセスを保護したり、従来のVPNを置き換えたり、ローカル環境のサービスをインターネットに公開したりする際に役立つ、信頼性の高いネットワークを構築するSkill。
📜 元の英語説明(参考)
Build zero-trust networks with Tailscale — mesh VPN setup, ACLs, exit nodes, subnet routing, MagicDNS, Funnel, SSH, and API automation. Use when tasks involve connecting remote machines, securing internal services, replacing traditional VPNs, or exposing local services to the internet.
🇯🇵 日本人クリエイター向け解説
Tailscaleは、離れた場所にある機器同士を安全に繋いだり、社内システムへのアクセスを保護したり、従来のVPNを置き換えたり、ローカル環境のサービスをインターネットに公開したりする際に役立つ、信頼性の高いネットワークを構築するSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o tailscale.zip https://jpskill.com/download/15450.zip && unzip -o tailscale.zip && rm tailscale.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/15450.zip -OutFile "$d\tailscale.zip"; Expand-Archive "$d\tailscale.zip" -DestinationPath $d -Force; ri "$d\tailscale.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
tailscale.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
tailscaleフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
Tailscale
サーバー、ラップトップ、クラウドインスタンスを、まるで同じLAN上にあるかのように接続する、ゼロトラストのメッシュネットワークを構築します。WireGuard上に構築され、コントロールプレーンを通じて管理されます。
セットアップ
# Debian/Ubuntu
sudo apt-get install -y apt-transport-https
curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/jammy.noarmor.gpg | sudo tee /usr/share/keyrings/tailscale-archive-keyring.gpg >/dev/null
curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/jammy.tailscale-keyring.list | sudo tee /etc/apt/sources.list.d/tailscale.list
sudo apt-get update && sudo apt-get install -y tailscale
sudo tailscale up
# Fedora/RHEL
sudo dnf config-manager --add-repo https://pkgs.tailscale.com/stable/fedora/tailscale.repo
sudo dnf install -y tailscale
sudo systemctl enable --now tailscaled
sudo tailscale up
# macOS
brew install tailscale
# Docker
docker run -d --name tailscale \
--cap-add NET_ADMIN --cap-add NET_RAW \
-v tailscale-state:/var/lib/tailscale \
-e TS_AUTHKEY=tskey-auth-... \
tailscale/tailscale
# 認証キーによる認証 (ヘッドレスサーバー)
sudo tailscale up --authkey=tskey-auth-...
# ステータスの確認
tailscale status
認証キー (Auth Keys)
https://login.tailscale.com/admin/settings/keys で生成します。
- Reusable — 複数のマシンで同じキーを使用 (フリートプロビジョニング)
- Ephemeral — 切断時にマシンを削除 (CIランナー、コンテナ)
- Pre-approved — 管理者の承認をスキップ
# Ephemeralノード (切断時に自動削除 — CI/CDランナーに最適)
tailscale up --authkey=tskey-auth-... --hostname=ci-runner-$(date +%s)
アクセス制御 (ACLs)
ACLは、誰が何にアクセスできるかを定義します。https://login.tailscale.com/admin/acls で編集するか、API経由で編集します。
{
"acls": [
// 開発者は開発およびステージングサーバーにアクセスできます
{"action": "accept", "src": ["group:devs"], "dst": ["tag:dev:*", "tag:staging:*"]},
// opsチームのみが本番環境にアクセスできます
{"action": "accept", "src": ["group:ops"], "dst": ["tag:prod:*"]},
// 誰もが共有サービスでDNSとHTTPSを使用できます
{"action": "accept", "src": ["*"], "dst": ["tag:shared:80,443,53"]},
// SSHはopsのみ
{"action": "accept", "src": ["group:ops"], "dst": ["*:22"]}
],
"groups": {
"group:devs": ["user@example.com", "dev2@example.com"],
"group:ops": ["ops@example.com"]
},
"tagOwners": {
"tag:dev": ["group:devs"],
"tag:staging": ["group:ops"],
"tag:prod": ["group:ops"],
"tag:shared": ["group:ops"]
}
}
サブネットルーター
すべてのマシンにTailscaleをインストールせずに、ネットワーク全体 (例: AWS VPC、オフィスLAN) を tailnet に公開します。
# ターゲットネットワーク内のゲートウェイマシン上
sudo tailscale up --advertise-routes=10.0.0.0/16,172.16.0.0/12
# IP転送を有効にする (必須)
echo 'net.ipv4.ip_forward = 1' | sudo tee -a /etc/sysctl.conf
echo 'net.ipv6.conf.all.forwarding = 1' | sudo tee -a /etc/sysctl.conf
sudo sysctl -p
管理パネルまたはAPIでルートを承認します。これで、すべての tailnet メンバーは、サブネットルーターを介して 10.0.0.0/16 にアクセスできます。
出口ノード
すべてのインターネットトラフィックを特定のマシン (従来のVPNのように) を経由させます。
# 出口ノード上 (例: 特定の国のVPS)
sudo tailscale up --advertise-exit-node
# クライアント上 — 出口ノードを使用
sudo tailscale up --exit-node=exit-server-hostname
# 確認 — 出口ノードのIPが表示されるはずです
curl ifconfig.me
MagicDNS
すべてのマシンにDNS名 hostname.tailnet-name.ts.net が割り当てられます。IPアドレスを覚える必要はありません。
# どこからでもホームサーバーにアクセス
ssh home-server.tailnet.ts.net
# データベースに接続
psql -h db-server.tailnet.ts.net -U postgres
# 内部サービスディスカバリー
curl http://api-server.tailnet.ts.net:3000/health
Tailscale SSH
SSHキーの管理を完全に置き換えます。Tailscaleは、あなたのIDを使用してSSH接続を認証します。
# サーバーでTailscale SSHを有効にする
sudo tailscale up --ssh
# 接続 — キーは不要、Tailscale IDによって認証されます
ssh user@server.tailnet.ts.net
# SSH ACL (ACLポリシーに追加)
# "ssh": [
# {"action": "accept", "src": ["group:ops"], "dst": ["tag:prod"], "users": ["root"]},
# {"action": "accept", "src": ["group:devs"], "dst": ["tag:dev"], "users": ["deploy"]}
# ]
Funnel (インターネットに公開)
ポートフォワーディングや動的DNSなしで、Tailscaleのインフラストラクチャを介してローカルサービスをパブリックインターネットに公開します。
# ローカルポートを公開的に提供
tailscale funnel 3000
# カスタムホスト名 (DNS設定が必要)
tailscale funnel --set-path /api 8080
# HTTPSサーブ (実際のTLS証明書を使用したローカル開発)
tailscale serve https / http://localhost:3000
tailscale serve status # 提供されているものを表示
API自動化
"""tailscale_api.py — tailnetをプログラムで管理します。"""
import requests
API = "https://api.tailscale.com/api/v2"
TAILNET = "example.com" # あなたのtailnet名
API_KEY = "tskey-api-..." # 管理パネル → 設定 → キー で生成
headers = {"Authorization": f"Bearer {API_KEY}"}
def list_devices() -> list:
"""tailnet内のすべてのデバイスを、IPとステータスとともにリストします。"""
resp = requests.get(f"{API}/tailnet/{TAILNET}/devices", headers=headers)
return resp.json()["devices"]
def set_device_tags(device_id: str, tags: list[str]):
"""デバイスにACLタグを設定します (例: ['tag:prod', 'tag:db'])。
Args:
device_id: list_devicesからのデバイスID。
tags: 適用するACLタグのリスト。
"""
requests.post(f"{API}/device/{device_id}/tags",
json={"tags": tags}, headers=headers)
def create_auth_key(reusable: bool = False, ephemeral: bool = False,
tags: list[str] = None) -> str:
"""自動デバイス登録用の認証キーを作成します。
Args:
reusable: キーが複数のデバイスを登録できるようにします。
ephemeral: 切断時にデバイスが自動的に削除されます。
tags: このキーを使用してデバイスに適用されるACLタグ。
"""
body = {
"capabilities": {
"devices": {
"create": { 📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Tailscale
Build zero-trust mesh networks that connect servers, laptops, and cloud instances as if they're on the same LAN. Built on WireGuard, managed through a control plane.
Setup
# Debian/Ubuntu
sudo apt-get install -y apt-transport-https
curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/jammy.noarmor.gpg | sudo tee /usr/share/keyrings/tailscale-archive-keyring.gpg >/dev/null
curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/jammy.tailscale-keyring.list | sudo tee /etc/apt/sources.list.d/tailscale.list
sudo apt-get update && sudo apt-get install -y tailscale
sudo tailscale up
# Fedora/RHEL
sudo dnf config-manager --add-repo https://pkgs.tailscale.com/stable/fedora/tailscale.repo
sudo dnf install -y tailscale
sudo systemctl enable --now tailscaled
sudo tailscale up
# macOS
brew install tailscale
# Docker
docker run -d --name tailscale \
--cap-add NET_ADMIN --cap-add NET_RAW \
-v tailscale-state:/var/lib/tailscale \
-e TS_AUTHKEY=tskey-auth-... \
tailscale/tailscale
# Authenticate with an auth key (headless servers)
sudo tailscale up --authkey=tskey-auth-...
# Check status
tailscale status
Auth Keys
Generate at https://login.tailscale.com/admin/settings/keys:
- Reusable — same key for multiple machines (fleet provisioning)
- Ephemeral — machine removed when it disconnects (CI runners, containers)
- Pre-approved — skips admin approval
# Ephemeral node (auto-removed on disconnect — good for CI/CD runners)
tailscale up --authkey=tskey-auth-... --hostname=ci-runner-$(date +%s)
Access Control (ACLs)
ACLs define who can reach what. Edit at https://login.tailscale.com/admin/acls or via API:
{
"acls": [
// Developers can reach dev and staging servers
{"action": "accept", "src": ["group:devs"], "dst": ["tag:dev:*", "tag:staging:*"]},
// Only ops team can reach production
{"action": "accept", "src": ["group:ops"], "dst": ["tag:prod:*"]},
// Everyone can use DNS and HTTPS on shared services
{"action": "accept", "src": ["*"], "dst": ["tag:shared:80,443,53"]},
// SSH only for ops
{"action": "accept", "src": ["group:ops"], "dst": ["*:22"]}
],
"groups": {
"group:devs": ["user@example.com", "dev2@example.com"],
"group:ops": ["ops@example.com"]
},
"tagOwners": {
"tag:dev": ["group:devs"],
"tag:staging": ["group:ops"],
"tag:prod": ["group:ops"],
"tag:shared": ["group:ops"]
}
}
Subnet Router
Expose an entire network (e.g., AWS VPC, office LAN) to your tailnet without installing Tailscale on every machine:
# On the gateway machine in the target network
sudo tailscale up --advertise-routes=10.0.0.0/16,172.16.0.0/12
# Enable IP forwarding (required)
echo 'net.ipv4.ip_forward = 1' | sudo tee -a /etc/sysctl.conf
echo 'net.ipv6.conf.all.forwarding = 1' | sudo tee -a /etc/sysctl.conf
sudo sysctl -p
Approve routes in the admin panel or via API. Now every tailnet member can reach 10.0.0.0/16 through the subnet router.
Exit Node
Route all internet traffic through a specific machine (like a traditional VPN):
# On the exit node (e.g., a VPS in a specific country)
sudo tailscale up --advertise-exit-node
# On the client — use the exit node
sudo tailscale up --exit-node=exit-server-hostname
# Verify — should show the exit node's IP
curl ifconfig.me
MagicDNS
Every machine gets a DNS name: hostname.tailnet-name.ts.net. No IP addresses to remember:
# Access your home server from anywhere
ssh home-server.tailnet.ts.net
# Connect to a database
psql -h db-server.tailnet.ts.net -U postgres
# Internal service discovery
curl http://api-server.tailnet.ts.net:3000/health
Tailscale SSH
Replace SSH key management entirely. Tailscale authenticates SSH connections using your identity:
# Enable Tailscale SSH on a server
sudo tailscale up --ssh
# Connect — no keys needed, authenticated by Tailscale identity
ssh user@server.tailnet.ts.net
# SSH ACL (add to your ACL policy)
# "ssh": [
# {"action": "accept", "src": ["group:ops"], "dst": ["tag:prod"], "users": ["root"]},
# {"action": "accept", "src": ["group:devs"], "dst": ["tag:dev"], "users": ["deploy"]}
# ]
Funnel (expose to internet)
Expose a local service to the public internet through Tailscale's infrastructure — no port forwarding, no dynamic DNS:
# Serve a local port publicly
tailscale funnel 3000
# Custom hostname (requires DNS setup)
tailscale funnel --set-path /api 8080
# HTTPS serve (local dev with real TLS cert)
tailscale serve https / http://localhost:3000
tailscale serve status # Show what's being served
API Automation
"""tailscale_api.py — Manage tailnet programmatically."""
import requests
API = "https://api.tailscale.com/api/v2"
TAILNET = "example.com" # Your tailnet name
API_KEY = "tskey-api-..." # Generate at admin panel → Settings → Keys
headers = {"Authorization": f"Bearer {API_KEY}"}
def list_devices() -> list:
"""List all devices in the tailnet with their IPs and status."""
resp = requests.get(f"{API}/tailnet/{TAILNET}/devices", headers=headers)
return resp.json()["devices"]
def set_device_tags(device_id: str, tags: list[str]):
"""Set ACL tags on a device (e.g., ['tag:prod', 'tag:db']).
Args:
device_id: Device ID from list_devices.
tags: List of ACL tags to apply.
"""
requests.post(f"{API}/device/{device_id}/tags",
json={"tags": tags}, headers=headers)
def create_auth_key(reusable: bool = False, ephemeral: bool = False,
tags: list[str] = None) -> str:
"""Create an auth key for automated device registration.
Args:
reusable: Allow key to register multiple devices.
ephemeral: Devices auto-removed on disconnect.
tags: ACL tags applied to devices using this key.
"""
body = {
"capabilities": {
"devices": {
"create": {
"reusable": reusable,
"ephemeral": ephemeral,
"tags": tags or [],
}
}
}
}
resp = requests.post(f"{API}/tailnet/{TAILNET}/keys",
json=body, headers=headers)
return resp.json()["key"]
def approve_routes(device_id: str, routes: list[str]):
"""Approve advertised subnet routes for a device.
Args:
device_id: Device ID.
routes: Routes to approve (e.g., ['10.0.0.0/16']).
"""
resp = requests.post(f"{API}/device/{device_id}/routes",
json={"routes": routes}, headers=headers)
return resp.json()
Fleet Provisioning
#!/bin/bash
# provision-fleet.sh — Add a batch of servers to the tailnet
SERVERS=("10.0.1.10" "10.0.1.11" "10.0.1.12" "10.0.1.13")
TAGS="tag:prod,tag:api"
# Create a reusable, pre-approved auth key with tags
AUTH_KEY=$(curl -s -X POST "https://api.tailscale.com/api/v2/tailnet/$TAILNET/keys" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d "{\"capabilities\":{\"devices\":{\"create\":{\"reusable\":true,\"tags\":[\"$TAGS\"]}}}}" \
| jq -r '.key')
for server in "${SERVERS[@]}"; do
ssh "$server" "sudo apt-get update && sudo apt-get install -y tailscale && \
sudo tailscale up --authkey=$AUTH_KEY --hostname=api-\$(hostname -s)" &
done
wait
echo "Fleet provisioning complete"
Docker Integration
Run services inside Docker accessible via tailnet:
# docker-compose.yml — Service accessible via Tailscale
services:
tailscale:
image: tailscale/tailscale
cap_add: [NET_ADMIN, NET_RAW]
volumes:
- tailscale-state:/var/lib/tailscale
environment:
TS_AUTHKEY: tskey-auth-...
TS_EXTRA_ARGS: --hostname=my-service
TS_SERVE_CONFIG: /config/serve.json
volumes:
- ./serve.json:/config/serve.json
app:
image: my-app:latest
network_mode: service:tailscale # Share Tailscale's network namespace
volumes:
tailscale-state:
Guidelines
- Auth keys for automation — never use interactive login for servers. Generate auth keys with appropriate tags.
- Tag everything — ACLs are tag-based. Untagged devices can't be referenced in policies. Tag at provisioning time.
- Ephemeral keys for ephemeral workloads — CI runners, preview environments, and containers should auto-remove when they disconnect.
- Subnet routers need IP forwarding — forgetting
sysctl net.ipv4.ip_forward=1is the #1 setup issue. - MagicDNS replaces IP addresses — use hostnames everywhere. IPs change; DNS names don't.
- Funnel for webhooks — expose a local development endpoint for testing webhooks from third-party services without ngrok.
- ACL testing — use
tailscale pingandtailscale netcheckto diagnose connectivity issues before blaming ACLs. - Key rotation — API keys and auth keys should be rotated regularly. Use short-lived keys where possible.