diff options
| author | Your Name <you@example.com> | 2026-02-08 20:23:31 +0800 |
|---|---|---|
| committer | Your Name <you@example.com> | 2026-02-08 20:23:31 +0800 |
| commit | c0e80820010cc5b0fdea1eb69bafef7f575e3201 (patch) | |
| tree | 94b8be5284bec668e1911bbe65e1b215ccd7657a /docs | |
Diffstat (limited to 'docs')
| -rw-r--r-- | docs | 37 |
1 files changed, 37 insertions, 0 deletions
| @@ -0,0 +1,37 @@ | |||
| 1 | # Headscale | ||
| 2 | # exercise to assert that it works | ||
| 3 | |||
| 4 | ## 1. Create VMs | ||
| 5 | python3 vm.py c mk testvm2-1 --image fedora42 --vcpu 6 --ram 4 --auto-download | ||
| 6 | python3 vm.py c mk testvm2-2 --image fedora42 --vcpu 6 --ram 4 --auto-download | ||
| 7 | |||
| 8 | ## 2. Check available public IPs | ||
| 9 | python3 vm.py n ipv4 --pool | ||
| 10 | |||
| 11 | ## 3. Attach public IP to server VM | ||
| 12 | python3 vm.py n ipv4 --attach 37.27.166.243 testvm2-1 | ||
| 13 | |||
| 14 | ## 4. SCP install.sh to server VM and run it | ||
| 15 | scp -i ~/k/k1 -o StrictHostKeyChecking=no /root/hypervisor/vm-claude/headscale/install.sh user@<testvm2-1-private-ip>:/tmp/install.sh | ||
| 16 | sshi testvm2-1.i "sudo bash /tmp/install.sh 37.27.166.243" | ||
| 17 | # Output includes the auth key, e.g.: | ||
| 18 | # hskey-auth-JK4Q793swFSJ-owovbUSFU1T71UyRiywcrIgERltcWq14h6vXT2LIFFA1naYkKLLGfL8E46cgUTOQ | ||
| 19 | |||
| 20 | ## 5. SCP client.sh to client VM and run it | ||
| 21 | scp -i ~/k/k1 -o StrictHostKeyChecking=no /root/hypervisor/vm-claude/headscale/client.sh user@<testvm2-2-private-ip>:/tmp/client.sh | ||
| 22 | sshi testvm2-2.i "sudo bash /tmp/client.sh 37.27.166.243 <AUTH_KEY>" | ||
| 23 | |||
| 24 | ## 6. Verify - ping server's tailscale IP from client | ||
| 25 | sshi testvm2-2.i "ping -c 3 100.64.0.1" | ||
| 26 | |||
| 27 | ## Cleanup | ||
| 28 | python3 vm.py n ipv4 --detach 37.27.166.243 testvm2-1 | ||
| 29 | echo "y" | python3 vm.py c rm testvm2-1 | ||
| 30 | echo "y" | python3 vm.py c rm testvm2-2 | ||
| 31 | |||
| 32 | ## Useful commands on the headscale server VM | ||
| 33 | headscale node list # list all registered nodes | ||
| 34 | headscale users list # list users | ||
| 35 | headscale preauthkeys create --user <USER_ID> --expiration 2160h --reusable # new auth key | ||
| 36 | headscale preauthkeys list --user <USER_ID> # list auth keys | ||
| 37 | curl http://<PUBLIC_IP>:8080/health # health check | ||
