What a resolver stores when it caches a record
Why lowering the TTL right before the cutover does nothing for cached copies
- At hour 0, a resolver fetches your A record. It caches the old IP with 86400 seconds to live.
- At hour 1, you lower the TTL to 300 on your authoritative servers. The resolver doesn't ask, so it still has 23 hours left on its copy.
- At hour 2, you switch the A record to the new IP. The resolver still doesn't ask.
- At hour 24, the cached copy expires. The resolver queries again and gets the new IP with a TTL of 300. From then on it refreshes every five minutes.
Other caches between the visitor and your server
proxy_pass is typically resolved when the configuration loads, so a reverse proxy in front of your app may keep sending traffic to the old IP until it is reloaded, unless it was set up to re-resolve.
Some resolver operators enforce a minimum cache TTL, so your 300 seconds may be held longer than you published. You can't control this from your side. You can only plan a margin for it.
Resolvers that implement serve-stale, described in RFC 8767, may keep answering with expired records if they cannot reach your authoritative servers. This matters when you move DNS hosting and shut down the old nameservers too early.
DNS also only affects new connections. Keep-alive HTTP connections, WebSockets, and other long-lived sessions stay on the old server until the client closes them, times out, or restarts. A client that has already resolved the new IP can still be talking to the old machine over a connection it opened earlier.
If the migration also changes nameservers at the registrar, a different TTL applies. The NS delegation sits in the parent zone, and its TTL is set by the registry, not by you. In that case, keep the old DNS provider serving the correct, updated zone until the delegation change has had time to spread.
Checking what resolvers are actually holding
BASH
# List the authoritative nameservers for the zone
dig +short NS example.com
# Ask one of them directly (replace with a name from the output above)
dig +noall +answer example.com A @ns1.example-dns.netBASH
dig +noall +answer example.com A @1.1.1.1
dig +noall +answer example.com A @8.8.8.8TEXT
example.com. 71842 IN A 203.0.113.10A cutover timeline that works
- Query your authoritative nameservers and note the current TTL on every record you plan to change. Include
www, the apex, mail-related names, and any API hostnames. This value is your waiting period. - Lower the TTL at least one old TTL before the planned cutover, plus a margin. Doubling the old TTL is a reasonable rule of thumb. Confirm that every authoritative nameserver serves the new TTL and that the SOA serials match.
- Before the cutover, check a few public resolvers. Their remaining TTLs should be at or below the new value. If one still shows a large number, wait.
- Switch the record to the new IP. Keep the old server running. If the site accepts writes such as orders, comments, or form submissions, either make the old copy read-only or have it proxy requests to the new server, so that no data lands on a machine you are about to retire.
- Watch the old server's logs until traffic drops to near zero. Expect a tail beyond the new TTL from resolvers that enforce a minimum TTL, from long-lived connections, and from clients with hardcoded hosts entries.
- Once the new server is stable, raise the TTL back to its normal value so resolvers stop querying your nameservers every few minutes.
dig before switching, and keep the old server answering until its logs go quiet.