Headscale是Tailscale控制服务器的开源、自托管实现。
如何运行Headscale? Getting Started
Linux上运行Headscale
要求
Ubuntu 20.04 或者更新,Debian 11 或者更新。
安装
- 下载平台对应的包:Headscale's releases page:
wget --output-document=headscale.deb \
https://github.com/juanfont/headscale/releases/download/v<HEADSCALE VERSION>/headscale_<HEADSCALE VERSION>_linux_<ARCH>.deb
- 安装Headscale
sudo dpkg --install headscale.deb
- 启用Headscale
sudo systemctl enable headscale
- 配置Headscale
vim /etc/headscale/config.yaml
- 启动Headscale
sudo systemctl start headscale
- 检查Headscale
systemctl status headscale
使用Headscale
- 创建用户
headscale users create myfirstuser
- 注册机器(常规登录)
在客户端,运行tailscale login命令:
tailscale up --login-server <YOUR_HEADSCALE_URL>
注册机器:
headscale --user myfirstuser nodes register --key <YOUR_MACHINE_KEY>
- 注册机器(预认证密钥)
Generate a key using the command line:
使用命令行创建密钥:
headscale --user myfirstuser preauthkeys create --reusable --expiration 24h
将返回一个预认证密钥,用于运行tailscale命令时,将节点连接到headscale。
tailscale up --login-server <YOUR_HEADSCALE_URL> --authkey <YOUR_AUTH_KEY>