I’m trying to set up systemd-resolved to forward DNS, using the guidance provided here. The catch is that I want all .consul
queries to be directed towards Consul, but all other queries to be directed towards the default nameserver list.
To that end, I have two configuration files: consul.conf
:
[Resolve]
DNS=127.0.0.1:8600
DNSSEC=false
Domains=~consul
and default.conf
:
[Resolve]
DNS=172.105.11.5 172.105.3.5 172.105.7.5
Domains=~.
The reason for having both is because queries to non-.consul
domains fail until I add something for other domains, since I’m symlinking /etc/resolv.conf
to the generated systemd-resolved stub.
Based on what I’m seeing, it works, but only until a non-.consul
domain is queried. Here, it works at first, but only until I query a .com
comain:
damien@nomad-server-ca-central-5a943497:~> sudo service systemd-resolved restart
damien@nomad-server-ca-central-5a943497:~> resolvectl query consul.service.consul
consul.service.consul: 2600:3c04::f03c:92ff:fe96:a166
-- Information acquired via protocol DNS in 4.7ms.
-- Data is authenticated: no
damien@nomad-server-ca-central-5a943497:~> resolvectl query google.com
google.com: 172.217.165.14 -- link: eth0
2607:f8b0:400b:802::200e -- link: eth0
-- Information acquired via protocol DNS in 6.9ms.
-- Data is authenticated: no
damien@nomad-server-ca-central-5a943497:~> resolvectl query consul.service.consul
consul.service.consul: resolve call failed: 'consul.service.consul' not found
Queries to consul.service.consul
work reliably until I query a non-.consul
domain, and then it immediately breaks until I restart systemd-resolved
.
Any idea what exactly is happening here? All I want to do really is direct .consul
domains to one set of DNS servers, and all other domains to another. Is that possible with systemd-resolved
?