0

I am trying to figure out how to do this properly. My servers use search-domain to find the FQDN, so my code can connect using redis as the host, etc.

I ran into a problem where the DNS provider for my domain was acting up and so "redis.example.com" wasn't working for a few seconds, which is not acceptable. I had to add the records manually to the host file while they fix their issue.

So my question is, what kind of DNS forwarder could I use for:

  1. Forward DNS requests to another server (example: 8.8.8.8)
  2. Cache records
  3. Use cached records, in case the DNS server is acting up, even if it means ignoring the TTL (my record's TTL is 60s but it's been 30 minutes since it requested from 8.8.8.8 last)
  4. Possibly always always cache and queue requesting from DNS server (so every 60s, latency doesn't go up a bit because it has to request it from the DNS server)

Any idea what I could do here? Or I'm I wishing for too much?

5
  • Increase your TTL - that's exactly what it's for.
    – MadHatter
    Jul 3, 2015 at 15:28
  • @MadHatter the idea of the low TTL is so "mysql-master" can change ips relatively quickly in case it goes down. Jul 3, 2015 at 15:39
  • 1
    You seem to want two contradictory things. Either the IP is reliable in the longer term, in which case, increase the TTL, so the RR can be cached in the normal way. Or it really does change frequently, at a minute's notice, in which case there's no point having a DNS server that caches it, as it will very likely be wrong. Which is it?
    – MadHatter
    Jul 3, 2015 at 15:42
  • It doesn't change frequently but I'd like to have the opportunity to swap out an IP quickly and have any service using it updated. I don't have the ability to use my own IPs (cloud provider). My point with caching is that it would be a safety precaution against the name server going down where I host my records (it's happened before). Jul 3, 2015 at 16:01
  • 1
    Yes, it would - which is why TTLs were invented. You are discovering one of the many reasons why DNS-based HA doesn't really work very well. My advice would be to get yourself a decent DNS provider - it's a highly-distributed system, and outages generally indicate very poor backends.
    – MadHatter
    Jul 3, 2015 at 16:13

1 Answer 1

0

I recommend using dnsmasq which will do all you want:

  • Forward dns queries to one or more dns servers
  • Pick up entries in hosts
  • Cache the queries

It works great and is very simple to configure, just install it using sudo apt-get install dnsmasq

For what you want, you would just add the line

server=8.8.8.8

and do sudo restart dnsmasq or sudo /etc/init.d/dnsmasq restart

Of course you can have several server=... lines to use more than one upstream dns server.

P.S. If you want, dnsmasq will also work as a complete dhcp server and will then add the host names of dhcp clients to the dns system, which is very nice indeed.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .