DNS server on Consul-client

Hello everybody.
Is it possible to turn on setting ports.dns=53 to turn on DNS server on Consul-client (exactly client)?
We want to implement this feature to turn on DNS caching on client’s side to redure a rate of requests, done to a server by putting setting dns_caching into consul client configuration.
DNS server and caching is turned on already in server side, but we want to make server load decrease by caching on client’s side.
Thanks in advance

Hello @evgeniy-lesin,

Welcome to the forums! :slight_smile:

I want to make sure I know what you’re looking for here.

  • Are you trying to get all of your DNS served by Consul?

  • Are you using BIND/DNSMasq or other external DNS (Route 53)?

  • Have you already look at DNS Forwarding and DNS Caching guides?

  • Can you please post your configuration, with the sensitive information removed?

In the configuration documentation, we do allow specifying dns.dns_config.use_cache and the max-age which should be configurable on the client agents. There is more information on agent caching as well.

I hope that my questions can help others to chime in as well!

I want to make sure I know what you’re looking for here.
Not so long ago we have noticed a high CPU usage on our consul-servers, growing constantly to 100% while consul-server service is not restarted.
While we investigate a problem on application’s side, which uses our consul-servers as a service discovery, we want to limit some rpc requests or make consul-client on application’s side using it’s own cache making requests count to consul server lower.
So my question is more like “can we use a dns_use_cache option in consul-client configuration without turning on dns server on it?”

Hi @evgeniy-lesin,

The use_cache configuration option that @jsosulska linked is all that is needed to enable caching in the Consul client agent.