安装
https://blog.kejilion.pro/headscale-tailscale-quickstart/
bash <(curl -sL kejilion.sh) app headscale
1. 反向代理
1panel 2个反代都需要指定后端域名为$http_host,不能为$http

| 管理后台 | 路径 | 地址 |
|---|---|---|
| admin | /admin | http://192.168.100.13:8081 |
| tailscale | / | http://192.168.100.13:8080 |

2. 反代后headscale配置更改
- /home/docker/headscale/headplane-config.yaml
root@vpn-LXC:/home/docker/headscale# vim headplane-config.yaml
server:
host: "0.0.0.0"
port: 3000
# base_url: "http://你的ip/admin/" #这里我们改成自己反代的域名
base_url: "https://tc.xyz:8443/admin/"
cookie_secret: "oWCn2P7+i4KrGivV33qjltCTd3ywjB6l"
cookie_secure: true
cookie_max_age: 604800
data_path: "/var/lib/headplane"
headscale:
url: "http://headscale:8080"
# public_url: "http://你的ip/admin/" #这里我们改成自己反代的域名
public_url: "https://tc.xyz:8443/"
config_path: "/etc/headscale/config.yaml"
api_key: "hskey-api-K8XEkI0v3d5D-mTlocVt6eP-SlJ2fsbEqpmVXLCzFqSVMyJC7-Bg9KFyRaZ6UZz4kwjKUOyhE3JQT"- /home/docker/headscale/config/config.yaml
# 里面的server_url也要改
server_url: https://tc.xyz:8443管理
https://tc.xyz:8443/admin/machines
hskey-api-K8XEkI0v3d5D-mTlocVt6eP-SlJ2fsbEqpmVXLCzFqSVMyJC7-Bg9KFyRaZ6UZz4kwjKUOyhE3JQT
登录
-
方式一: 设备执行
tailscale up --login-server=https://tc.xyz:8443,获取机器码,拿机器码去admin注册即可 -
方式二: 直接执行带秘钥的指令
tailscale up --login-server=https://tc.xyz:8443 --authkey hskey-auth-q17wNSrTP3rF-GZhJTPXjjnfHEhGa9P-8Kp8bu6q_ObTmph8QKJE6hDOa3AwfyqqX6IjLMngc6A7X
注意:
- windows安装后不要点击图标,要用指令:
tailscale up --login-server=https://tc.xyz:8443 - 安卓也是,要找到配置服务器的地方:
## Configuring the headscale URL[¶](https://headscale.net/0.23.0/usage/connect/android/#configuring-the-headscale-url "Permanent link")
- Open the app and select the settings menu in the upper-right corner
- Tap on `Accounts`
- In the kebab menu icon (three dots) in the upper-right corner select `Use an alternate server`
- Enter your server URL (e.g `https://headscale.example.com`) and follow the instructionsdocker 登录
version: '3.8'
services:
tailscale:
image: tailscale/tailscale
container_name: tailscale
hostname: tailscale-docker # 设备名称可以换
network_mode: "host"
#cap_add:
# - NET_ADMIN
#- NET_RAW
environment:
# 对应你的 --authkey
- TS_AUTHKEY=hskey-auth-q17wNSrTP3rF-GZhJTPXjjnfHEhGa9P-8Kp8bu6q_ObTmph8QKJE6hDOa3AwfyqqX6IjLMngc6A7X
# 为了支持容器在重启后仍能保留其设置和
- TS_STATE_DIR=/var/lib/tailscale
- TS_EXTRA_ARGS=--login-server https://tc.xyz:8443 --accept-dns=true
devices:
- /dev/net/tun:/dev/net/tun
volumes:
- ./tailscale-var-lib:/var/lib/tailscale
- /dev/net/tun:/dev/net/tun
restart: unless-stopped
volumes:
tailscale-var-lib: