Dynamic ip address on one domain address?

hi
does anyone have an idea that how can i do something like this?

They just put multiple A records into DNS with TTL of 1800

ubuntu:~$ dig uk.ko2add.com

;; ANSWER SECTION:
uk.ko2add.com.          1800    IN      A       146.185.24.132
uk.ko2add.com.          1800    IN      A       146.185.24.134
uk.ko2add.com.          1800    IN      A       146.185.24.133

This is really just old-school poor-man’s load balancing / fault tolerance (not that it doesn’t have its place, mind you - the technique has just been around for quite a long time).

I tried it in Mikrotik’s static hosts configuration for DNS proxy, and you can add the same hostname several times with different IP addresses and it will give them all in response to queries.

tnx

every time i use dig to find ttl it gives me different ttl

;; ANSWER SECTION:
uk.ko2add.com.          848     IN      A       146.185.24.133
uk.ko2add.com.          848     IN      A       146.185.24.134
uk.ko2add.com.          848     IN      A       146.185.24.132



;; ANSWER SECTION:
uk.ko2add.com.          1310    IN      A       146.185.24.134
uk.ko2add.com.          1310    IN      A       146.185.24.133
uk.ko2add.com.          1310    IN      A       146.185.24.132

This is normal, what you see there is the “remaining TTL” in the resolver cache, which is counting down to zero.

i flush the dns cash :slight_smile:
one time ttl start countdown from 5min (300 sec )
one time from 30min

But you use an external resolver, don’t you?
This has a cache as well!

Dig doesn’t use the cache of the local host - it’s like a browser for DNS (without the cacheing) and gives an exact report of what some server replies to some query you specify.

If you’re querying any resolver other than the authoritative DNS server, you’re going to get the TTL of whatever remains in that resolver’s cache.

Think of it like an expiration date on milk. Suppose you bought 100L of milk and it has 14 days until it’s expired. If you sold some of it 3 days later, you don’t tell the person who bought it that it’s good for 14 days, you’d tell them that it’s good for 11 days. If they sold some to someone else 5 days later, they wouldn’t tell the next person the milk was good for 11 days, but 6 days. Etc.

General rule of thumb for me:
To see what DNS servers are saying, use dig / nslookup
To see what my computer’s got cached, I just try to ping the name and see what IP comes back (whether or not the pings work)

Because ping uses the local host DNS cache, where dig and nslookup do not. (Of course if you’re running a recursive/fowarding dns resolver daemon on the local host, this can be deceptive if you’re not thinking carefully - the resolver daemon will have its own cache that is separate from the “system” resolver, even if the system is set to use 127.0.0.1 as the dns server. Dig and nslookup would skip the system resolver and get the recursive/forwarder daemon’s cache (127.0.0.1) if you don’t specify some other host ( e.g. @8.8.8.8 )