用途:管理 Tailscale Funnel 路由,适用于配置隧道或对外 HTTPS 访问的场景。
主要能力:查看当前状态(获取主机名、列出全部路由、检查端口监听);添加服务路由(根路径同一时间只能由一个服务占用,子路径可多个共存);移除路由;改动后进行健康检查;提供常见故障排查思路。
常用命令(保持原样): tailscale status --json | jq -r '.Self.DNSName' | sed 's/.$//' tailscale funnel status tailscale funnel --bg <port> tailscale serve --bg --set-path /<path> http://localhost:<port> tailscale funnel --https=443 off tailscale serve --https=443 --set-path /<path> off
规则:路由可共存。添加根路由不会移除子路径路由,添加子路径也不会移除根路由。
健康检查:每次改动后同时验证本地与外部。外部检查示例:curl -s --max-time 10 "https://${HOSTNAME}/<path>" -o /dev/null -w "%{http_code}\n"。本地成功不能证明 Funnel 端到端可用。
限制与排查:Funnel 需在 tailnet 的 ACL 策略中启用;外部无响应通常是 Funnel 未激活;外部 502 多为端口上服务未运行;重启后 funnel 路由会持久化,但 serve 路由可能不会,需重新添加。原则:同一路径只对应一个服务,非主服务优先用子路径,改动后务必用外部 curl 验证。