4

In my internal work network, whenever I launch dig against a particular hostname, I get result similar to this:

;; ANSWER SECTION:
some.internal.host.com.     10  IN  A   10.210.54.121

If I keep spamming the same dig some.internal.host.com command, the response always has a single A record, but the IP address is changing between calls.

I assume it is some form of load-balancing, but the full list of IP addresses in the pool is hidden from inquisitive persons.

What could be the technique that is used here to achieve the described result?

2 Answers 2

7

'10' in the output is TTL. It is short, 10 seconds, so one can guess that this is dynamically changing. That's why it should not live in DNS recursive servers' cache for more than 10 seconds.

How is it done? It depends on remote DNS server and the way it is implemented. Either hidden nodes dynamically (de-)register into DNS or DNS could be "detecting" alive backend hosts itself.

1
  • This is common for load balancers and DNS servers that implement fast failover.
    – Barmar
    Mar 23, 2021 at 17:16
4

It could be a round robin approach.

Usually you deliver all valid addresses and the client picks one to connect to.

If you have badly implemented clients, you might need to force their pick by only offering one value.

The other option is load balancing based on how busy the different servers are. The DNS is then used as a cheap load balancer. Cheap compared to one or more real load balancers with, for example, multiple IP addresses that proxy all requests to the servers.

2
  • FYI this happens a lot; the simplest way of coding a connect to host routine is to code it as hosts[0] (in fact in the old C library there's a macro that does this for you). Doing the round-robin yourself with a really short cache timeout works ...
    – joshudson
    Mar 20, 2021 at 2:16
  • 1
    Most DNS servers already shuffle the order of answers for multiple A (or AAAA) records, so returning one at a time seems like an overkill to me.
    – iBug
    Mar 20, 2021 at 11:30

You must log in to answer this question.

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