Skip to content

Commit b6b2efa

Browse files
committed
docs: add tailscale custom derp script usage
1 parent 1876e49 commit b6b2efa

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

  • docs/cheatsheet/network/tailscale

docs/cheatsheet/network/tailscale/index.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,45 @@ sudo tailscale up \
127127
* **协议**: UDP
128128
* **端口**: `41641` (这是 Tailscale 默认首选端口,放行它能大幅减少掉线和延迟)
129129
* **方向**: 入站 (Inbound) 和 出站 (Outbound)
130+
131+
---
132+
133+
### 🧩 7. 自建 DERP 一键切换
134+
135+
仓库内提供了一个跨平台 PowerShell 入口,可把当前设备切到你自己的 DERP 服务器,并在需要时恢复到应用前的普通 Tailscale 配置。
136+
137+
#### 应用自建 DERP
138+
139+
```powershell
140+
./scripts/pwsh/network/tailscale/Set-TailscaleDerp.ps1 -ServerIp 203.0.113.10
141+
```
142+
143+
默认会生成受管 `derp.json`,并调用等价于:
144+
145+
```powershell
146+
tailscale up --derp-map-url=file:///.../derp.json --tls-skip-verify
147+
```
148+
149+
如果你需要自定义端口或 Region 元数据,也可以显式指定:
150+
151+
```powershell
152+
./scripts/pwsh/network/tailscale/Set-TailscaleDerp.ps1 `
153+
-ServerIp 203.0.113.10 `
154+
-RegionId 900 `
155+
-RegionCode cn-custom `
156+
-NodeName cn-node `
157+
-DerpPort 8443 `
158+
-StunPort 3478
159+
```
160+
161+
#### 取消并恢复默认行为
162+
163+
```powershell
164+
./scripts/pwsh/network/tailscale/Set-TailscaleDerp.ps1 -Reset
165+
```
166+
167+
这不会执行 `tailscale down`,而是按脚本保存的应用前基线配置执行恢复。
168+
169+
#### 兼容性提醒
170+
171+
如果当前 `tailscale` 客户端不支持 `--derp-map-url``--tls-skip-verify`,脚本会直接报错,并提示你升级或切换到支持这些 flag 的构建。

0 commit comments

Comments
 (0)