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