Hello,
As discussed here DNS Lookup via systemd-resolved on Ubuntu Minimal 18.04 · Issue #5875 · hashicorp/consul · GitHub I open a topic in this discussion board, sorry for a delay.
Documentation here did not work for me for several reasons that will be outlined below.
I am using AWS as a cloud platform and Ubuntu Minimal 18.04 AMI.
Consul Agent is 1.5.1 and runs as a server. Internal communication and client interfaces are bind to local IPv4 (10.0.0.0 will be used as example) using both -bind and -client options. There are no custom DNS configuration in Consul.
dig @10.0.0.0 -p 8600 consul.service.consul ANY
;; ANSWER SECTION:
consul.service.consul. 0 IN A 10.0.0.0
consul.service.consul. 0 IN TXT “consul-network-segment=”
consul.service.consul. 0 IN A 10.0.0.1
consul.service.consul. 0 IN TXT “consul-network-segment=”
consul.service.consul. 0 IN A 10.0.0.2
consul.service.consul. 0 IN TXT “consul-network-segment=”
consul.service.consul. 0 IN A 10.0.0.3
consul.service.consul. 0 IN TXT “consul-network-segment=”
consul.service.consul. 0 IN A 10.0.0.4
consul.service.consul. 0 IN TXT “consul-network-segment=”
With CURL:
curl http://consul.service.consul
curl: (6) Could not resolve host: consul.service.consul`
Ubuntu 18.04 uses systemd-resolved as DNS forwarder and binded to 127.0.0.53:53
netstat -tulpn | grep LISTEN | grep systemd-resolve
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 565/systemd-resolve
/etc/resolv.conf has following configuration:
cat /etc/resolv.conf
nameserver 127.0.0.53
options edns0
search eu-west-1.compute.internal
Also /etc/resolv.conf is a symlink to /run/systemd/resolve/stub-resolv.conf.
There is also /run/systemd/resolve/resolv.conf that has following config:
cat /run/systemd/resolve/resolv.conf
nameserver 10.0.0.2
search eu-west-1.compute.internal
I change /etc/systemd/resolved.conf
to have following:
DNS=10.0.0.0
Domains=~consul
Than I play with iptables trying to replace localhost with either 10.0.0.0 or 127.0.0.53 but still does not work for me.
Could you please help me to figure out.
Thank you.