Search code examples
dnsttl

Does a TTL get triggered from the time the record is created or at a certain interval like a cron job?


I just wanted to get a basic understanding of how TTLs work from the stand point of when exactly the record will refresh. Say I create a DNS record with a TTL of 1800 at 09:05 UTC, does that mean it will refresh at 09:35 UTC or 09:30 UTC?

This behaviour is important for me to understand as if it is the latter (where the record gets refreshed at 1800 second intervals - so every half an hour), then I can time my DNS record updates so that they are within a couple of minutes of refresh time so as to limit the amount of time the request points to the old address.

Any assistance on this is much appreciated.


Solution

  • https://www.varonis.com/blog/dns-ttl/

    DNS TTL (time to live) represents the time each step takes for DNS to cache a record. The TTL is like a stopwatch for how long to keep a DNS record.

    In other words, a DNS record with a TTL of 1800 (30 minutes) will "live" for 30 minutes ... from the time it is received by the caching server.

    From the same link:

    How Long Will it Take My DNS to Update? To honestly know that everyone is seeing an updated DNS record, it is essential to calculate how long it will “actually” take to propagate across DNS. This is accomplished by using the following formula

    TTL X (number of steps) = Fully propagated

    For example, if your set TTL is 1800 seconds and there are five steps (not counting the authoritative server), then your fully propagated time would be 9000 seconds or no longer than 2 hours and 30 minutes.