Keine Beschreibung

mrh 677c2adaca 基本的 tailscale + headscale 部署在公网服务器中 vor 1 Jahr
demo 677c2adaca 基本的 tailscale + headscale 部署在公网服务器中 vor 1 Jahr
headscale 677c2adaca 基本的 tailscale + headscale 部署在公网服务器中 vor 1 Jahr
.gitignore 677c2adaca 基本的 tailscale + headscale 部署在公网服务器中 vor 1 Jahr
Caddyfile 677c2adaca 基本的 tailscale + headscale 部署在公网服务器中 vor 1 Jahr
docker-compose.yaml 677c2adaca 基本的 tailscale + headscale 部署在公网服务器中 vor 1 Jahr
gpt.md 677c2adaca 基本的 tailscale + headscale 部署在公网服务器中 vor 1 Jahr
readme.md 677c2adaca 基本的 tailscale + headscale 部署在公网服务器中 vor 1 Jahr

readme.md

安装

https://headscale.net/stable/setup/install/official/

sudo systemctl stop wg-quick@wg
sudo systemctl disable wg-quick@wg
sudo ufw allow 41641/udp
set-proxy
HEADSCALE_VERSION="0.25.1" # See above URL for latest version, e.g. "X.Y.Z" (NOTE: do not add the "v" prefix!)
HEADSCALE_ARCH="amd64" # Your system architecture, e.g. "amd64"
wget --output-document=headscale.deb \
 "https://github.com/juanfont/headscale/releases/download/v${HEADSCALE_VERSION}/headscale_${HEADSCALE_VERSION}_linux_${HEADSCALE_ARCH}.deb"
sudo apt install ./headscale.deb
# 参考 https://github.com/juanfont/headscale/blob/main/config-example.yaml
sudo vi /etc/headscale/config.yaml
sudo systemctl start headscale
sudo systemctl enable headscale
sudo systemctl status headscale
# sudo headscale users create mrh
# User created
# sudo headscale users list

curl -fsSL https://tailscale.com/install.sh | sh
# sudo tailscale up --login-server  http://localhost:9809/
# # 请注意这个密码是随机的
# sudo headscale nodes register --user mrh --key lHE6IUqDYpwT_bJkkMW9WECq
# sudo headscale nodes list

https://luotianyi.vc/8480.html

dc exec  caddy caddy reload --config /etc/caddy/Caddyfile
# dc exec headscale headscale apikeys create --expiration 9999d
# docker exec -it headscale headscale users create mrh
# 创建可重用秘钥,秘钥不会失效,让用户自行管理
docker exec -it headscale headscale preauthkeys create --user mrh --reusable --expiration 99999d 
90e2d5089997c0ef0929eaa8475ac441de0fe9acae43cfbd

# 指定云服务器,注册
sudo tailscale up --login-server https://hs.magong.site  --authkey 90e2d5089997c0ef0929eaa8475ac441de0fe9acae43cfbd --hostname dy1 --netfilter-mode=off --accept-dns=true
# 云服务器如果自己配置了内网 DNS 服务器,需要指定该网卡的 search 域名
sudo resolvectl domain eth0 ~.

# 别的设备注册
sudo tailscale up --login-server https://hs.magong.site  --authkey 90e2d5089997c0ef0929eaa8475ac441de0fe9acae43cfbd  --netfilter-mode=off --accept-dns=true --reset
# sudo tailscale up --login-server http://101.126.130.39:27896 --authkey 90e2d5089997c0ef0929eaa8475ac441de0fe9acae43cfbd

sudo lsof -i :41641
docker exec headscale headscale nodes list
ip route show table 52
tailscale ping 100.64.0.1

sudo tailscale status

# 下线
sudo tailscale down
sudo tailscale up
sudo tailscale down
# 删除节点
docker exec -it headscale headscale nodes delete -i 1
docker exec -it headscale headscale nodes delete -i 2
# sudo tailscale up --login-server http://localhost:27896/ --force-reauth

可以修改 ip 地址

sudo sqlite3   /root/program/headscale/headscale/data/db.sqlite
sudo sqlite3 /home/mrh/program/headscale/headscale/data/db.sqlite
SELECT id, hostname, ipv4 FROM nodes;
UPDATE nodes SET ipv4 = "100.64.0.5" WHERE id=1;

MagicDNS 冲突的问题

https://sh.alynx.one/posts/Who-Moved-My-DNS-Resolving/

# 建议指定为云服务器的内网 DNS 服务器
sudo resolvectl domain eth0 ~.

# 下述实测未解决
sudo ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
sudo apt-get install network-manager
systemctl enable NetworkManager
systemctl restart NetworkManager
systemctl status NetworkManager
ping mirrors.ivolces.com