Deploying Headscale on a VPS: private mesh VPN, ACL, DNS, and client connections
TL;DR
Headscale is a self-hosted control server for Tailscale clients. It lets you create your own mesh VPN network on a VPS, manage nodes, ACL rules, and MagicDNS without relying on a cloud control plane. In this guide, Headscale is installed on Ubuntu 24.04 LTS, secured with Caddy and HTTPS, and clients are connected using Tailscale.
- Headscale runs on a small VPS: 1 vCPU, 1 GB RAM, and 10–20 GB SSD are usually sufficient.
- Only TCP 80 and 443 are opened for external connections; SSH is best restricted to your IP address.
- Clients are joined into a mesh VPN and can connect directly whenever possible.
- The ACL file restricts access between groups and servers.
- MagicDNS lets you access nodes by name instead of IP address.
- You need to back up the Headscale database, configuration, TLS data, and ACL policy.
1. TL;DR
Headscale is not a VPN client or a regular VPN gateway. It is a management server for Tailscale-compatible clients: it assigns addresses, distributes settings, coordinates connections, and applies access policies. User traffic itself goes directly between nodes whenever possible, while the VPS is primarily needed for management, NAT traversal, and DERP relaying when a direct connection is unavailable.
The setup below uses a separate domain, headscale.example.com, Ubuntu 24.04 LTS, Headscale 0.27.x, Caddy 2.x, and SQLite. For a production environment, replace the domain, SSH addresses, and secrets with your own values.
dnsVPS for your own VPN
Matching plans from verified providers, prices updated daily.
Compare:Vultr vs DigitalOceanVultr vs ContaboVPS paid with cryptoVPN services compared
Affiliate links: we may earn a commission, your price stays the same.
2. Table of Contents
The sequence is intended for a new VPS with a public IPv4 address. IPv6 is desirable but not required. If the server is already used for other web services, check that ports 80 and 443 are available, or configure a reverse proxy in the existing infrastructure.
3. What We Are Configuring and Why
The Role of Headscale in VPN Infrastructure
Tailscale is built on WireGuard, but hides the complexity of manually configuring keys, routes, and NAT. In classic WireGuard, the administrator creates each peer configuration manually. With Headscale, nodes register in a central system, receive addresses from a private range, and automatically learn about other network members.
Headscale is an open implementation of a control server compatible with Tailscale clients. The server does not decrypt VPN traffic: cryptographic keys remain on endpoint devices. However, the control server stores network metadata, the node list, their public keys, and routing parameters, so it must also be protected and backed up regularly.
What You Will Get
- A private network with addresses from the
100.64.0.0/10range. - Connection of laptops, servers, phones, and virtual machines through Tailscale.
- Access to SSH, HTTP, databases, and internal services through the VPN.
- An ACL policy that allows access only to the required groups.
- MagicDNS for names such as
git-1.mesh.example.com. - HTTPS on the control server and automatic certificate renewal.
Headscale, Tailscale Cloud, or Regular WireGuard
| Option | Advantages | Limitations |
|---|---|---|
| Regular WireGuard | Minimal components, full control, high predictability | Peer configurations and routes must be maintained manually |
| Tailscale Cloud | Easy setup, ready-made admin panel, managed control plane | Dependency on an external service and its policies |
| Headscale on a VPS | Independent control plane management, compatibility with Tailscale clients | Updates, backups, TLS, and monitoring become the owner's responsibility |
The self-hosted option is justified when you need to control the domain, metadata, and device registration rules, and when the team is ready to maintain a Linux server independently. For several personal devices, the cloud option is usually simpler. For dozens or hundreds of corporate devices, Headscale requires a well-planned user model, ACLs, and backup recovery in advance.
How the Connection Works
After registration, the client receives keys and information about other nodes. Clients attempt to establish a direct UDP session through NAT traversal. If a direct connection is impossible, a DERP relay is used. A VPS running Headscale does not necessarily carry all traffic through itself, so the load is usually significantly lower than with a traditional VPN gateway.
If internet traffic must be forcibly routed through one server, that is a separate exit node task. It requires enabling IP forwarding, configuring NAT, and explicitly allowing routes. In the basic configuration of this article, nodes can access each other, but client internet traffic is not routed through the VPS.
4. What VPS Configuration Is Needed for This Task
Minimum Requirements
| Resource | Minimum | Practical Option |
|---|---|---|
| CPU | 1 vCPU | 2 vCPU |
| RAM | 512 MB, without significant DERP traffic | 1–2 GB |
| Disk | 10 GB SSD | 20–40 GB SSD |
| Network | Public IPv4, 100 Mbps | Public IPv4 and IPv6, 1 Gbps |
| OS | Ubuntu 24.04 LTS or Debian 12 | Ubuntu 24.04 LTS |
For a control server serving 10–50 devices, 1–2 vCPU and 1 GB RAM are sufficient. SQLite is suitable for a small to medium installation if the database is stored on a local SSD and copied regularly. The main variable is not the number of registered nodes, but the volume of traffic through the DERP relay.
As a practical option, you can choose a VPS with these specifications: 2 vCPU, 2 GB RAM, 30 GB NVMe, public IPv4, IPv6, and a 1 Gbps port. This capacity allows you to host Headscale, Caddy, monitoring, and a small private DNS service at the same time.
When a Dedicated Server Is Needed
A dedicated server for Headscale itself is usually excessive. It becomes justified if the VPS must simultaneously operate as a powerful DERP relay, an exit node for a large number of users, a router for multiple networks, or a host for other resource-intensive services. Dedicated hardware may also be required due to isolation requirements, predictable performance, or a large volume of encrypted traffic.
Choosing a Location
Location affects control plane and DERP relay latency. With a direct connection, Headscale's geography is almost irrelevant after state exchange. When DERP is used, latency between nodes depends on the distance to the relay, so for an international team it makes sense to place the server closer to most users or deploy multiple DERP relays in different regions.
Check for a static IPv4 address, pay attention to UDP restrictions and the provider's VPN policy. Even though Headscale uses HTTPS for the control plane, WireGuard clients prefer UDP, so network restrictions may degrade direct connections.
5. Server Preparation
DNS and Basic Parameters
Before installation, create an A DNS record for headscale.example.com pointing to the VPS IPv4 address. If IPv6 is used, add an AAAA record. Check it from the local computer:
# Проверяем, что домен указывает на нужный адрес
dig +short A headscale.example.com
dig +short AAAA headscale.example.com
The examples below assume that you are logged in as a temporary user with sudo privileges. Do not work permanently as root.
Creating an Administrator and SSH Key
On the workstation, create an Ed25519 key if you do not already have one:
# Создаём современную пару SSH-ключей
ssh-keygen -t ed25519 -a 100 -f ~/.ssh/headscale_ed25519
# Копируем публичный ключ на сервер
ssh-copy-id -i ~/.ssh/headscale_ed25519.pub root@SERVER_IP
Connect to the server and create a separate administrator:
# Создаём пользователя для администрирования
adduser deploy
usermod -aG sudo deploy
# Создаём каталог SSH и устанавливаем права
install -d -m 700 -o deploy -g deploy /home/deploy/.ssh
install -m 600 -o deploy -g deploy /root/.ssh/authorized_keys /home/deploy/.ssh/authorized_keys
In a new terminal window, verify the login:
# Проверяем вход без пароля
ssh -i ~/.ssh/headscale_ed25519 deploy@SERVER_IP
Updates and Basic Packages
# Обновляем индексы и устанавливаем исправления безопасности
sudo apt update
sudo DEBIAN_FRONTEND=noninteractive apt full-upgrade -y
# Устанавливаем инструменты администрирования и диагностики
sudo apt install -y ca-certificates curl wget jq unzip vim-tiny \
ufw fail2ban sqlite3 dnsutils chrony unattended-upgrades
Enable time synchronization. Accurate clocks are required for TLS and the correct operation of temporary registration keys:
# Включаем службу синхронизации времени
sudo systemctl enable --now chrony
# Проверяем состояние часов
timedatectl status
SSH, Firewall, and fail2ban
Before enabling the firewall, make sure that the current SSH session remains open and that a new login as user deploy works. If SSH is accessible only from a fixed network, restrict port 22 to its address.
# Разрешаем SSH, HTTP и HTTPS
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow 22/tcp
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
# Включаем firewall
sudo ufw --force enable
sudo ufw status verbose
To further restrict SSH, replace the general rule with one using your public address:
# Пример: разрешаем SSH только из административной сети
sudo ufw delete allow 22/tcp
sudo ufw allow from ADMIN_PUBLIC_IP to any port 22 proto tcp
Disable password authentication only after verifying key-based login:
# Создаём отдельную настройку SSH
sudo tee /etc/ssh/sshd_config.d/ hardening.conf >/dev/null <<'EOF'
PasswordAuthentication no
KbdInteractiveAuthentication no
PermitRootLogin no
PubkeyAuthentication yes
EOF
# Проверяем синтаксис и применяем настройки
sudo sshd -t
sudo systemctl reload ssh
In the last command above, there must be no space between the directory and the filename in the actual shell. Use the correct version:
# Записываем SSH-настройки в правильный путь
sudo tee /etc/ssh/sshd_config.d/hardening.conf >/dev/null <<'EOF'
PasswordAuthentication no
KbdInteractiveAuthentication no
PermitRootLogin no
PubkeyAuthentication yes
EOF
sudo sshd -t
sudo systemctl reload ssh
# Запускаем защиту от перебора SSH-паролей
sudo systemctl enable --now fail2ban
sudo fail2ban-client status sshd
6. Software Installation — Step by Step
Step 1. Determine the Version and Architecture
As of 2026, use the current stable Headscale release from the 0.27.x branch for a new installation. Before deploying to production, check the project's release page and replace the variable with the latest stable version. Do not use an automatically floating URL in critical infrastructure without prior testing.
# Проверяем архитектуру сервера
uname -m
# Фиксируем версию Headscale для повторяемой установки
export HEADSCALE_VERSION="0.27.1"
export HEADSCALE_ARCH="amd64"
Step 2. Download the Official Package
The release package is obtained from the official Headscale GitHub repository. For ARM64, replace the architecture value with arm64 if the corresponding package is available in the selected release.
# Скачиваем Debian-пакет из официального релиза
cd /tmp
curl -fLO "https://github.com/juanfont/headscale/releases/download/v${HEADSCALE_VERSION}/headscale_${HEADSCALE_VERSION}_linux_${HEADSCALE_ARCH}.deb"
# Устанавливаем Headscale и его systemd unit
sudo apt install -y "./headscale_${HEADSCALE_VERSION}_linux_${HEADSCALE_ARCH}.deb"
# Проверяем установленную версию
headscale version
Step 3. Create Directories and a System User
# Создаём каталог данных и конфигурации
sudo install -d -m 750 -o headscale -g headscale /var/lib/headscale
sudo install -d -m 750 -o headscale -g headscale /etc/headscale
# Проверяем, что пакет создал системного пользователя
getent passwd headscale
Step 4. Create the Headscale Configuration
Generate a random Noise key. It is used by the control server to establish secure sessions with clients and must not be committed to a public repository.
# Генерируем приватный ключ Noise
sudo sh -c 'umask 077; openssl rand -hex 32 > /var/lib/headscale/noise_private.key'
# Назначаем владельца ключа
sudo chown headscale:headscale /var/lib/headscale/noise_private.key
Create the configuration file. The domain and subnet values must be consistent with the ACL and your existing infrastructure.
# /etc/headscale/config.yaml
server_url: https://headscale.example.com
listen_addr: 127.0.0.1:8080
metrics_listen_addr: 127.0.0.1:9090
noise:
private_key_path: /var/lib/headscale/noise_private.key
prefixes:
v4: 100.64.0.0/10
v6: fd7a:115c:a1e0::/48
derp:
server:
enabled: false
urls:
- https://controlplane.tailscale.com/derpmap/default
database:
type: sqlite
sqlite:
path: /var/lib/headscale/db.sqlite
dns:
magic_dns: true
base_domain: mesh.example.com
nameservers:
global:
- 1.1.1.1
- 9.9.9.9
search_domains: []
extra_records_path: /etc/headscale/dns-records.json
policy:
mode: file
path: /etc/headscale/acl.hujson
log:
level: info
# Защищаем конфигурацию и проверяем владельца
sudo chown root:headscale /etc/headscale/config.yaml
sudo chmod 640 /etc/headscale/config.yaml
Step 5. Create DNS Records for MagicDNS
The additional records file allows internal names to point to specific addresses. At the initial stage, you can leave an empty array.
[
{
"name": "git.mesh.example.com",
"type": "A",
"value": "100.64.0.20"
}
]
# Создаём файл дополнительных DNS-записей
sudo tee /etc/headscale/dns-records.json >/dev/null <<'EOF'
[]
EOF
sudo chown root:headscale /etc/headscale/dns-records.json
sudo chmod 640 /etc/headscale/dns-records.json
Step 6. Configure systemd
If the package did not install a ready-made unit or you want to explicitly set the startup parameters, create your own systemd file:
# /etc/systemd/system/headscale.service
[Unit]
Description=Headscale coordination server
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=headscale
Group=headscale
ExecStart=/usr/bin/headscale serve
Restart=on-failure
RestartSec=5
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=strict
ProtectHome=true
ReadWritePaths=/var/lib/headscale
ReadOnlyPaths=/etc/headscale
[Install]
WantedBy=multi-user.target
# Перечитываем unit-файлы и запускаем Headscale
sudo systemctl daemon-reload
sudo systemctl enable --now headscale
# Проверяем статус и последние сообщения журнала
sudo systemctl status headscale --no-pager
sudo journalctl -u headscale -n 50 --no-pager
Step 7. Install Caddy
Caddy will accept HTTPS requests, obtain a Let’s Encrypt certificate, and proxy requests to Headscale on localhost. Use the official Caddy repository.
# Устанавливаем ключ и репозиторий Caddy
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | \
sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | \
sudo tee /etc/apt/sources.list.d/caddy-stable.list
# Устанавливаем Caddy 2.x из официального репозитория
sudo apt update
sudo apt install -y caddy
Step 8. Connect the HTTPS Reverse Proxy
# /etc/caddy/Caddyfile
headscale.example.com {
reverse_proxy 127.0.0.1:8080
header {
Strict-Transport-Security "max-age=31536000"
X-Content-Type-Options "nosniff"
Referrer-Policy "no-referrer"
}
log {
output file /var/log/caddy/headscale-access.log
format json
}
}
# Проверяем синтаксис Caddyfile
sudo caddy validate --config /etc/caddy/Caddyfile
# Запускаем Caddy и применяем конфигурацию
sudo systemctl enable --now caddy
sudo systemctl reload caddy
# Проверяем HTTPS-ответ
curl -I https://headscale.example.com/
The response from the root URL may not be an HTML page. A successful TLS connection and the absence of a reverse proxy error are what matter. If the certificate is not issued, check the DNS, TCP port 80 accessibility, and ensure that no other process is using the port.
7. Configuration
Creating the first user
In Headscale, a user is the logical owner of nodes. Do not confuse it with a Linux user. Create separate spaces for personal devices, servers, or different teams.
# Create a user for device administration
sudo headscale users create admin
# Display the list of users and note the name
sudo headscale users list
ACL policy
It is best to store ACLs in Git, but do not include secrets in the repository. Below is an example policy for two groups: administrators can connect to servers, while developers can access only the Git server and application SSH port. The syntax uses HUJSON: comments are allowed, and quotes around keys can be retained for clarity.
{
"groups": {
"group:admins": [
"admin@",
],
"group:developers": [
"dev@",
],
},
"hosts": {
"git": "100.64.0.20",
"app": "100.64.0.21",
"db": "100.64.0.22",
},
"acls": [
{
"action": "accept",
"src": ["group:admins"],
"dst": [":"],
},
{
"action": "accept",
"src": ["group:developers"],
"dst": ["git:22", "git:443", "app:22"],
},
],
"ssh": [
{
"action": "check",
"src": ["group:admins"],
"dst": ["autogroup:tagged"],
"users": ["autogroup:nonroot", "root"],
},
{
"action": "check",
"src": ["group:developers"],
"dst": ["git"],
"users": ["autogroup:nonroot"],
},
],
}
The addresses in the hosts field must match the node addresses in Headscale. In a real environment, it is useful to use tags for servers and separate groups for people. Do not add the : rule unless necessary: it turns the ACL into permission for the entire mesh network.
# Verify that the file exists and is readable
sudo stat /etc/headscale/acl.hujson
# Restart Headscale after changing the policy
sudo systemctl restart headscale
# Check the log for configuration parsing errors
sudo journalctl -u headscale -n 80 --no-pager
Client registration via pre-auth key
For servers, it is more convenient to use a one-time or short-lived pre-auth key. Do not send it through public chats or save it in shell history unless necessary.
# Create a registration key valid for 24 hours for the admin user
sudo headscale preauthkeys create \
--user admin \
--expiration 24h
Copy the displayed key and run the following on the client Linux server:
# Install the Tailscale client on Debian/Ubuntu
curl -fsSL https://tailscale.com/install.sh | sh
# Connect the node to your own Headscale
sudo tailscale up \
--login-server=https://headscale.example.com \
--authkey=PASTE_PREAUTH_KEY \
--accept-dns=true
# Check the local client state
sudo tailscale status
For interactive registration without a pre-auth key, run tailscale up --login-server=https://headscale.example.com. The client will display a URL. Open it in a browser, then register the appearing node on the server:
# Display nodes awaiting registration
sudo headscale nodes list
# Associate the node with a user by its identifier
sudo headscale nodes register --user admin --key nodekey:PASTE_NODE_KEY
# Display the list of registered nodes again
sudo headscale nodes list
Node names and connection verification
# Rename the node for clear display
sudo headscale nodes rename --identifier NODE_ID --new-name git-1
# Check nodes on the Headscale server
sudo headscale nodes list
# Check the address and mesh VPN state on the client
tailscale ip
tailscale status
tailscale netcheck
Check the connection from another node:
# Check access by VPN address
ping -c 3 100.64.0.20
# Check SSH through the mesh network
ssh [email protected]
# Check the MagicDNS name
getent hosts git-1.mesh.example.com
ping -c 3 git-1.mesh.example.com
DNS and MagicDNS
MagicDNS adds names of registered devices to the domain specified in base_domain. Tailscale clients must accept DNS settings, so the --accept-dns=true parameter is important. If a local DNS manager is used on the workstation, such as systemd-resolved, NetworkManager, or a corporate agent, check what actually manages DNS.
Do not use the mesh network domain as a public DNS zone with conflicting records. It is practical to allocate a separate subdomain, such as mesh.example.com, and not publish it in the public zone, or leave only the necessary records there.
Routes to the private network
To access a LAN through a subnet-router node, you need to enable forwarding on that node, advertise the route, and approve it on the Headscale server. This is a separate risk area: a routing error can expose internal networks to unnecessary users.
# Enable IPv4 forwarding on the Linux subnet router
echo 'net.ipv4.ip_forward=1' | sudo tee /etc/sysctl.d/99-tailscale-forwarding.conf
sudo sysctl --system
# Advertise the internal subnet through Tailscale
sudo tailscale up \
--advertise-routes=192.168.10.0/24 \
--accept-dns=true
After this, the route must be approved using Headscale and restricted with ACLs. Do not advertise the 0.0.0.0/0 route unless you intentionally create an exit node.
8. Backups and maintenance
What needs to be backed up
/var/lib/headscale/db.sqlite— registered nodes, users, and server state./etc/headscale/config.yaml— main configuration./etc/headscale/acl.hujson— access policy./etc/headscale/dns-records.json— additional DNS records./var/lib/headscale/noise_private.key— critical Headscale private key./etc/caddy/Caddyfileand the Caddy certificate directory.
Compromise of the Noise key backup and database may give an attacker valuable information about the control plane. Store archives in separate encrypted storage, restrict access, and do not keep the only copy on the same VPS.
Simple backup with restic
Below is an example using S3-compatible storage. Connection values are passed through a separate environment file with 600 permissions. For production, use a bucket with versioning and a separate access key that is allowed access only to the required bucket.
# Install restic from the Ubuntu repository
sudo apt install -y restic
# Create a file with repository parameters
sudo install -m 600 /dev/null /root/.restic-headscale.env
sudo tee /root/.restic-headscale.env >/dev/null <<'EOF'
export RESTIC_REPOSITORY="s3:https://s3.example.net/headscale-backups"
export AWS_ACCESS_KEY_ID="CHANGE_ME"
export AWS_SECRET_ACCESS_KEY="CHANGE_ME"
export RESTIC_PASSWORD="CHANGE_ME_LONG_RANDOM_PASSWORD"
EOF
# Initialize the repository once
sudo bash -c 'source /root/.restic-headscale.env && restic init'
The script first creates an SQLite dump, then archives configuration files and certificates:
# /usr/local/sbin/backup-headscale
#!/usr/bin/env bash
set -euo pipefail
source /root/.restic-headscale.env
backup_dir="$(mktemp -d)"
trap 'rm -rf "$backup_dir"' EXIT
# Create a consistent SQLite snapshot
sqlite3 /var/lib/headscale/db.sqlite ".backup '$backup_dir/headscale.sqlite'"
# Copy configuration, keys, and TLS settings
install -d "$backup_dir/etc-headscale" "$backup_dir/caddy"
cp -a /etc/headscale/. "$backup_dir/etc-headscale/"
cp -a /etc/caddy/Caddyfile "$backup_dir/caddy/"
# Upload the archive to remote storage
restic backup "$backup_dir" --tag headscale
# Remove old restore points
restic forget --tag headscale --keep-daily 7 --keep-weekly 4 --keep-monthly 6 --prune
# Set permissions on the script
sudo chmod 700 /usr/local/sbin/backup-headscale
# Run a test backup
sudo /usr/local/sbin/backup-headscale
# Add a daily cron run
echo '15 03 * root /usr/local/sbin/backup-headscale >> /var/log/headscale-backup.log 2>&1' | \
sudo tee /etc/cron.d/headscale-backup
Periodically verify restoration:
# View available restore points
sudo bash -c 'source /root/.restic-headscale.env && restic snapshots'
# Check repository integrity
sudo bash -c 'source /root/.restic-headscale.env && restic check'
Updates
Headscale is a stateful service, so update it during a maintenance window. Before updating, save a backup, read the release notes, and check configuration format compatibility. Do not update Headscale, the OS, Caddy, and client applications simultaneously without being able to identify the source of a problem.
# Stop the service before replacing the binary package
sudo systemctl stop headscale
# Install the new package downloaded and verified in advance
sudo apt install -y /tmp/headscale_NEW_VERSION_linux_amd64.deb
# Start the service and check the log
sudo systemctl start headscale
sudo systemctl status headscale --no-pager
sudo journalctl -u headscale -n 100 --no-pager
For a single VPS, a rolling update is not possible: while the control plane restarts, client registration and state updates may be unavailable, although already established VPN connections may sometimes continue to work. If high availability is required, design a separate architecture with an external database, multiple control servers, and support for this setup verified for the specific Headscale version.
Observability
At a minimum, monitor the systemd status, TLS certificate expiration, disk usage, HTTPS availability, and age of the latest backup.
# Quick check of service status and disk
systemctl is-active headscale caddy
df -h /
curl -fsS https://headscale.example.com/ >/dev/null
sudo journalctl -u headscale --since "1 hour ago" --no-pager
9. Troubleshooting and FAQ
Headscale does not start after changing config.yaml
First check the log: sudo journalctl -u headscale -n 100 --no-pager. Common causes include a YAML error, an incorrect path to the database or Noise key, insufficient permissions for the headscale user, and parameters from another version. Make sure the file can be read by the service and that the /var/lib/headscale directory is writable. After fixing the issue, run sudo systemctl restart headscale and check the status again.
The client reports a problem with the login server or TLS
Check the DNS record using dig, the availability of https://headscale.example.com with curl -Iv, and the Caddy logs. TCP ports 80 and 443 must be allowed in UFW and the provider's external firewall. If the certificate was not issued, make sure the domain points specifically to this VPS and that another web service has not occupied port 80. The client command must use the full URL with HTTPS.
The node appeared but is not visible in the mesh network
On the server, run headscale nodes list, and on the client, run tailscale status and tailscale netcheck. Check that the node is registered with the correct user and that its local firewall allows the Tailscale interface. An ACL error can also appear as a lack of access even though registration completed successfully. For diagnosis, temporarily check access to the specific address and port without opening the entire network.
MagicDNS does not resolve names
Make sure dns.magic_dns: true is enabled in the configuration, base_domain is set, and the client is running with --accept-dns=true. The tailscale ip and tailscale status commands can help confirm the client status. On Linux, check resolvectl status; a third-party VPN, NetworkManager, or corporate DNS agent may be overwriting the settings. If access by IP is all that is needed, DNS can be temporarily disabled to distinguish a network issue from a name-resolution issue.
The connection works through DERP but is slow
Run tailscale netcheck on both nodes and check whether UDP is available and which DERP region was selected. This symptom usually means that NAT or a firewall is blocking the direct UDP session. Allow outbound UDP and check whether the provider uses symmetric NAT. For remote users, you can deploy additional DERP relays closer to their regions, but first make sure the issue actually affects performance rather than being related to overload on the destination server.
What is the minimum suitable VPS configuration?
For Headscale itself, 1 vCPU, 512 MB RAM, 10 GB SSD, and a public IPv4 address are sufficient. It is more practical to choose 2 vCPUs, 1–2 GB RAM, and 20–40 GB SSD: this leaves room for Caddy, logs, monitoring, and a small amount of DERP traffic. Open TCP ports 80/443, a stable network, and backups are more important than performance. If a large volume of relay or exit-node traffic will pass through the server, focus primarily on bandwidth and CPU.
What should you choose — VPS or dedicated for this task?
A VPS is almost always sufficient for the control server. A dedicated server is needed not because of Headscale itself, but because of associated workloads: a large DERP relay, an exit node, routing for several office networks, or strict isolation requirements. Start with a VPS and measure CPU, RAM, network traffic, and latency. Moving to a dedicated server makes sense when virtualization or network-channel limitations are confirmed by metrics rather than assumed in advance.
Can SQLite be used in production?
For a single Headscale instance with a small number of nodes, SQLite is suitable if the database is stored on a local SSD and regular consistent backups are performed. Do not place the database file on a network file system or copy it with a simple cp during active writes. For a large installation, study the external database versions supported by your Headscale version in advance and test migrations on a copy.
Is it safe to expose Headscale to the internet?
Only the control server's HTTPS endpoint should be public; the database and administrative SSH should not be accessible to everyone. Use up-to-date versions, HTTPS, restricted SSH, fail2ban, a firewall, and short-lived pre-auth keys. ACL does not replace updates and endpoint protection. Remember that Headscale manages node registration: a compromise of the VPS or its private keys requires immediate investigation, secret rotation, and possibly re-issuing the trusted infrastructure.
10. Conclusions and Next Steps
As a result, Headscale runs on a VPS behind Caddy and HTTPS, Tailscale clients are connected in a private mesh VPN, and access between nodes is controlled by ACL and MagicDNS. The configuration does not require routing all user traffic through the VPS, so a small server is usually sufficient.
Next, verify restoration from backup, add monitoring for certificate and disk expiration, and then formalize groups, tags, and ACL rules. As the load grows, you can move DERP relays to additional regions, add subnet routes, or design a separate exit node with restricted access.