Repository navigation
Description
Background
I'm deploying Consul. Consul runs a process on each host, exposing (among many other things) a DNS interface. This allows for service discovery via lookups under the consul domain.
For example, if I have a prometheus service configured, I might configure some other piece of software to find it via the prometheus.service.barrethouse.consul DNS name.
Configuring systemd-resolved
I would like random applications in the system to be able to resolve these DNS records, so I want to make them accessible via systemd-resolved. The consul documentation recommends configuring the consul agent as the sole entry in resolved's DNS= setting. It also recommends some iptables shenanigans, so I'm not going take its recommendations as gospel.
Ideally, I want to be able to direct queries under the consul domain to 127.0.0.1:8600, while having a different configuration for other domains. In particular, I'd like to enable DNSOverTLS for queries not to consul. However, it's not clear how to do this at the moment.
An idealized configuration
My dream is to be able to specify something like this
[Resolve]
DNS=127.0.0.1:8600
Domains=~consul
DNSOverTLS=no
[Resolve]
DNS=1.1.1.1#cloudflare-dns.com
FallbackDNS=1.1.1.1#cloudflare-dns.com
Domains=~.
DNSOverTLS=yes
That is, for the [Resolve] blocks to be essentially keyed on the Domains entry, and not merged. At the moment, I believe the above configuration file is equivalent to the following:
[Resolve]
DNS=127.0.0.1:8600 1.1.1.1#cloudflare-dns.com
FallbackDNS=1.1.1.1#cloudflare-dns.com
Domains=~consul ~.
DNSOverTLS=yes
This is based on the following, from the resolved.conf man page:
When multiple files specify the same option, for options which accept just a single value,
the entry in the file with the lexicographically latest name takes precedence. For options
which accept a list of values, entries are collected as they occur in files sorted lexicographically.
Request
- Is my understanding of the behaviour of multiple
[Resolve]blocks correct? - Is specifying different configurations for different domains possible in systemd-resolved today?
- If not, is it within the scope of the systemd-resolved project?
Activity
vlada-dudr commentedon Jan 14, 2021
If one wants to configure one such a service, then it might enough to enable DNS to loopback and route requests there with standard tooling systemd, already has
ivan1986 commentedon Sep 27, 2021
Want same feture, but for opennic domain (geek, lib, pirate and other)
aadnehovda commentedon Oct 26, 2021
I'm not sure I really understand why resolved seems to be designed around per-interface routing domains in the first place. Why does the DNS server/domain have to be tied to a specific interface? Because of the integration with networkd?
jonesmz commentedon Jan 30, 2022
This feature can also be useful for environments that use active directory. Queries for the active directory's name should go to the AD DNS, but queries to any other top level domain should go to a non-AD DNS server.
resolved: add new "DNS Delegate" concepts (#34368)