Lesson 1 of 3
Zero-downtime DNS migrations
2 min
Changing nameservers or moving a site to new IPs doesn't have to cause an outage. The trick is planning around caches.
Before the move
- Export the full zone from the current provider: every A, AAAA, CNAME, MX, TXT, SRV and CAA record.
- Recreate it at the new provider and check it before switching:
dig @new-ns1.example.net yourcompany.com MX. - Lower TTLs to 300 seconds at least one full old-TTL period before the change.
Switching nameservers
Change the NS records at the registrar. The parent zone's NS TTL is often 48 hours and you can't lower it, so keep both providers serving identical data until well after the change.
Moving a site to new IPs
- Bring up the new server and test it with a hosts-file override.
- Update the A/AAAA records.
- Keep the old server running until traffic to it stops; some resolvers ignore low TTLs.
Check both directions: dig +short yourcompany.com @8.8.8.8 and @1.1.1.1. Different resolvers clear their caches at different times.
Afterwards
Raise TTLs again (3600 or more). Low TTLs mean more queries and slower first loads.