如何在 Linux 上将 tailscale 连接到 headscale 服务器
另请参阅我们的指南如何使用 docker-compose 在 5 分钟内设置 headscale 服务器
假设你在 https://headscale.mydomain.com 运行 headscale 服务器,并且你已经创建了一个命名空间名为 mynamespace,使用以下方法之一:
预认证密钥方法*(推荐)*
首先,在服务器上创建一个有效期为 24 小时的预认证密钥令牌:
create_preauthkey.sh
headscale preauthkeys create -e 24h -n mynamespace或(docker-compose 版本)
create_preauthkey_docker.sh
docker-compose exec headscale headscale preauthkeys create -e 24h -n mynamespace这将生成一个预认证密钥,如 3215a1ce7967c11e8ea844b3e199d3c46f9f5e7b660b48fb,你可以发送给用户。
现在在客户端上使用以下命令登录
tailscale_up_authkey.sh
tailscale up --login-server https://headscale.mydomain.com --authkey 3215a1ce7967c11e8ea844b3e199d3c46f9f5e7b660b48fb直接登录方法
tailscale_up_direct.sh
tailscale up --login-server https://headscale.mydomain.com在客户端上,这将显示一个 URL,用于在 headscale 服务器上使用浏览器访问。这将反过来给你一个命令,你需要在运行 headscale 容器的主机上运行。如果使用 docker-compose 运行 headscale,在命令前添加 docker-compose exec headscale 并将 NAMESPACE 替换为你的命名空间名称。
我不推荐此方法的唯一原因是它需要用户和管理员之间的来回交互,我认为这不实际。
Check out similar posts by category:
Headscale, Linux, Networking, VPN
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow