Reputation: 126
In Windows, when I setup Consul service for Service discovery in local network, I used DNS Interface for query service. But when I query service with this command
dig -x 127.0.0.1 -p 53 consul.service.consul +short
And it returned nothing.
Currently, my local network DNS address is 10.18.200.103
. But when I changed to Consul server 10.18.200.202
, it worked and return correct data.
I want to know how can my local DNS server find the domain of Consul services without changing DNS to Consul server
Upvotes: 5
Views: 1232
Reputation: 7258
You can set your local DNS as recursor in consul config, then set consul as your primary DNS server and your normal DNS as secondary. This will pass requests through consul first.
If consul is up, it will resolve *.consul domain and pass everything else to recursors. If consul is down, OS will pass request to secondary DNS and it will still end up resolved.
"recursors": [ "10.18.200.103" ],
https://www.consul.io/docs/agent/dns.html
Upvotes: 2