2021-10-21 20:48:29 +02:00
# DNS in headscale
2021-10-02 11:11:18 +02:00
2021-10-21 20:48:29 +02:00
headscale supports Tailscale's DNS configuration and MagicDNS. Please have a look to their KB to better understand what this means:
2021-10-02 11:11:18 +02:00
- https://tailscale.com/kb/1054/dns/
- https://tailscale.com/kb/1081/magicdns/
- https://tailscale.com/blog/2021-09-private-dns-with-magicdns/
2021-10-21 20:48:29 +02:00
Long story short, you can define the DNS servers you want to use in your tailnets, activate MagicDNS (so you don't have to remember the IP addresses of your nodes), define search domains, as well as predefined hosts. headscale will inject that settings into your nodes.
2021-10-02 11:11:18 +02:00
## Configuration reference
2021-10-21 21:01:52 +02:00
The setup is done via the `config.yaml` file, under the `dns_config` key.
2021-10-19 20:51:43 +02:00
```yaml
server_url: http://127.0.0.1:8001
listen_addr: 0.0.0.0:8001
dns_config:
nameservers:
2021-10-21 21:01:52 +02:00
- 1.1.1.1
- 8.8.8.8
2021-10-19 20:51:43 +02:00
restricted_nameservers:
foo.bar.com:
2021-10-21 21:01:52 +02:00
- 1.1.1.1
2021-10-19 20:51:43 +02:00
darp.headscale.net:
2021-10-21 21:01:52 +02:00
- 1.1.1.1
- 8.8.8.8
2021-10-19 20:51:43 +02:00
domains: []
magic_dns: true
base_domain: example.com
2021-10-02 11:11:18 +02:00
```
2021-10-19 20:51:43 +02:00
2021-10-21 21:01:52 +02:00
- `nameservers` : The list of DNS servers to use.
2021-10-02 11:11:18 +02:00
- `domains` : Search domains to inject.
2021-10-04 22:50:33 +02:00
- `magic_dns` : Whether to use [MagicDNS ](https://tailscale.com/kb/1081/magicdns/ ). Only works if there is at least a nameserver defined.
2021-10-19 20:51:43 +02:00
- `base_domain` : Defines the base domain to create the hostnames for MagicDNS. `base_domain` must be a FQDNs, without the trailing dot. The FQDN of the hosts will be `hostname.namespace.base_domain` (e.g., _myhost.mynamespace.example.com_ ).
2021-10-21 21:01:52 +02:00
- `restricted_nameservers` : Split DNS (see https://tailscale.com/kb/1054/dns/), list of search domains and the DNS to query for each one.