In the previous article, you created your own Headscale server. This article will teach you how to connect your devices to your Headscale server.
Step 1: Install Tailscale on your device.
curl -fsSL https://tailscale.com/install.sh | sh
Step 2: Enter the following command to connect your device to your Headscale server.
sudo tailscale up --login-server https://headscale.silicon.blog --advertise-routes=10.100.0.0/20 --accept-routes=true --accept-dns=false
Step 3: Go to your Headscale web UI. In my case, it is https://headscale.silicon.blog/web. It will redirect you to your Authelia domain. Enter your Authelia username and password created before.
Step 4: Check the name of your Headscale docker container by
sudo docker ps
Replace your_headscale with the name of your Headscale docker.
sudo docker exec -it your_headscale headscale apikey create
In my case, it is
sudo docker exec -it headscale-headscale-1 headscale apikey create
It will generate something like this
Step 5: Go back to your Headscale web UI. In my case, it is https://headscale.silicon.blog/web. Input your Headscale domain as Headscale URL. Enter the API key generated in Step 4.
Step 6: Go to the User View section, and create a new user.
Step 7: Go to the Device View section, and add a new device. Enter the nodekey:xxx generated in Step 2 as the device key and select a corresponding user. Click the tick button after configuration.
Step 8: You may edit the device name after adding it to your Headscale server. Also, a ‘SUCCESS’ will be displayed on your device terminal.
Congratulation! Everything is functioning properly!