计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
headscale-routing【效率与协作】Configure subnet routers and exit nodes in a Headscale tailnet to extend mesh access to non-Tailscale devices and route internet traffic. Use when setting up subnet routing for LAN devices or configuring exit nodes for privacy.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Subnet routers extend a tailnet to non-Tailscale devices (printers, NAS boxes, IoT devices) by advertising the local LAN subnet routes through a gateway node. Exit nodes route all non-tailnet internet traffic through a home server, providing privacy on untrusted networks (coffee shop Wi-Fi, hotel networks, etc.).
Headscale manages route approval centrally — routes must be advertised by the gateway node and then approved on the Headscale server before they become active.
tailscale up --advertise-routes=192.168.1.0/24
headscale routes approve -r <route-id>
tailscale up --accept-routes
tailscale up --advertise-exit-node
tailscale set --exit-node=<node-name>
Configure Headscale ACL policy to auto-approve routes from trusted nodes:
{
"autoApprovers": {
"routes": {
"192.168.0.0/16": ["tag:gateway"]
},
"exitNode": ["tag:gateway"]
}
}
Nodes carrying tag:gateway will have their advertised routes or exit-node status
approved automatically without manual intervention.
Use grants.via in ACL policies to restrict cross-subnet access:
{
"grants": [
{
"src": ["tag:monitoring"],
"dst": ["tag:servers"],
"app": ["prometheus"],
"via": ["192.168.10.0/24"]
}
]
}
This ensures traffic from monitoring nodes to servers is routed through the specified subnet, enabling firewall policies on the gateway to inspect or filter traffic.
By default, Headscale enables Source NAT (SNAT) on subnet router traffic. This means traffic originating from tailnet clients destined for the advertised subnet appears to come from the gateway node's IP. To disable SNAT:
tailscale up --advertise-routes=192.168.1.0/24 --snat-subnet-routes=false
Disable SNAT when the downstream network needs to see the original client IP for logging, ACLs, or per-device firewall rules.
# List all routes with status
headscale routes list
# Approve a specific route
headscale routes approve -r <route-id>
# Approve all routes from a node
headscale routes approve --all -n <node-name>
# Reject a route
headscale routes reject -r <route-id>
--accept-routes on clients: Clients will NOT use advertised subnet routes
unless they themselves run with --accept-routes or have it in their up flags.headscale routes CLI commands
above require shell access to the Headscale server. For remote management, use
the Headscale REST API with $HEADSCALE_URL and $HEADSCALE_API_KEY.| Variable | Description |
|---|---|
HEADSCALE_URL | Headscale server URL |
HEADSCALE_API_KEY | API key from headscale apikeys create |
Refer to individual script help (--help) for usage details:
| Script | Description |
|---|---|
hs-advertise-routes.sh | Advertise subnet routes on a Tailscale node |
hs-approve-routes.sh | List and approve/reject routes on Headscale |
hs-list-routes.sh | List all routes with detailed status |
Do not use this skill for node lifecycle management (load headscale-node-lifecycle instead) or for writing ACL policies (load tailnet-policy). It covers subnet routers and exit nodes only.