Support >
  About cybersecurity >
  How to seamlessly change DNS resolution during website migration? Methods to minimize downtime.

How to seamlessly change DNS resolution during website migration? Methods to minimize downtime.

Time : 2026-06-06 10:29:27
Edit : DNS.COM

  Website migration, while not a major undertaking, isn't insignificant either. But there's one thing every website owner dreads—after switching DNS, some users can access the site, while others can't; emails won't send, APIs won't work, and users will experience endless loading before finally getting a "connection failed" message. Even more frustrating is that even if you think your operation is flawless, some users will still cling to the old server. This is the problem of DNS caching.

  First, understand a basic fact: DNS doesn't take effect instantly.

  Many people misunderstand DNS, thinking that changing a resolution record allows the whole world to immediately access the new server. This idea is completely wrong.

  DNS was never designed for "real-time updates." Its core goal is "efficient lookups." To achieve efficiency, there's caching at every layer. Your computer has a DNS cache, your router has a cache, your ISP's recursive DNS servers have a cache, and there may be various public DNS caches in between.

  The effect of a DNS record isn't a matter of "changing a configuration," but rather "waiting for all caches to expire."

  Every DNS record has a TTL (Time To Live) value, which means "how long this record will remain in the cache." Common default values ​​are 600 seconds (10 minutes), 3600 seconds (1 hour), or even 86400 seconds (1 day).

  You can think of it this way: TTL is like telling the world, "This IP address won't change for the next X seconds, so you can cache it with confidence." During this time, no DNS server will query your origin server; it will directly use the cached result to answer the user.

  Therefore, if you set the TTL to 24 hours and then change the IP address, someone will inevitably access the old server within the next 24 hours. This isn't a bug; it's how DNS works.

  The core idea for reducing downtime: Pre-migration strategy

  Once you understand TTL, you'll know what the core strategy for lossless migration is—not "how to make the cache expire faster," but "how to ensure that users aren't affected when the cache expires." This strategy involves three steps.

  Step 1: Reduce TTL Values ​​in Advance

  24 to 48 hours before your actual migration, reduce the TTL values ​​of all DNS records you want to change from a high value (e.g., 3600 seconds) to a very low value, such as 60 seconds or 120 seconds.

  Why so much advance notice? Because TTL values ​​are cached. If you change the TTL from 1 hour to 1 minute, the DNS servers that queried 1 hour ago will still have records with a 1-hour TTL. You must wait for that initial hour to pass, for all cached records to expire naturally, before the new TTL value (1 minute) takes effect. This process requires at least the original TTL duration.

  In short: Changing the TTL itself requires a TTL cycle to take effect. Therefore, doing this one or two days in advance is necessary.

  Step 2: Verify the New Environment, But Don't Cut Traffic

  After reducing the TTL, your new server should be deployed, but not yet open to the public. At this point, you can do a few things:

  Force the domain name to point to the new server IP by modifying your local hosts file, performing full functional testing. Alternatively, use curl with the `resolve` parameter to test specific APIs. You can also find several test nodes on different networks to verify the performance and stability of the new environment.

  The purpose of this step is to ensure the new server is "ready to go online at any time," rather than discovering problems only when switching.

  Step 3: Switching During a Low-Traffic Window

  The TTL is already 1 minute. Choose a low-traffic period (usually early morning) and modify the DNS records to point to the new IP. Because the TTL is very low, the global DNS cache will be updated within 2 minutes at most, and user traffic will begin to flow to the new server.

  However, there is one more detail: Established TCP connections will not automatically disconnect due to DNS updates. Some users' browsers may still maintain long-lived connections to the old server. Therefore, the old server cannot be shut down immediately; it should be retained for at least 24-48 hours, doing only one thing—redirecting received requests with a 301 redirect to the new domain or returning a graceful message.

  Dual-Track Operation: A More Elegant Solution Than Traffic Slicing

  The solutions mentioned above can already control downtime to within a few minutes. But if you're aiming for "zero interruption," there's a more advanced approach—dual-track operation.

  The core idea of ​​dual-track operation is to keep both the old and new servers online simultaneously, using a mechanism to allow different users to access different versions until everyone transitions smoothly.

  How exactly does it work?

  If you're using Nginx or Apache, you can configure a reverse proxy on the old server. When a request arrives on the old server, determine its purpose: if the request doesn't require write operations (e.g., just browsing articles), it can continue processing on the old server. If it involves write operations (e.g., submitting a form, placing an order), it's reverse-proxied to the new server for processing.

  The cost of this is that the old server becomes a "forwarder," increasing latency, but the benefit is that users are completely unaware of the migration process.

  If you're using a cloud service provider's load balancer, it's even simpler. Add both the old and new servers to the load balancer's backend pool, but give the new server a very low weight, for example, 99% of traffic to the old server and 1% to the new server. Observe for a period of time; if there are no problems, gradually increase the weight: 10%, 30%, 50%, 100%. This process is called "canary release."

  Once 100% of the traffic is on the new server, the old server can be gracefully taken offline.

  Another easily overlooked aspect: DNS propagation monitoring

  No matter what strategy you use, one question always remains—how do you know the entire world has switched over?

  You can't assume. You must use tools to verify.

  Recommended tools include:

  DNS lookup websites: Free tools like dnschecker.org can query dozens of DNS resolution nodes globally at once to see if your domain's resolution result is the new IP. It's very clear.

  Command-line tools: `dig +trace yourdomain.com` can trace the complete DNS resolution chain, telling you what each level returned. `nslookup yourdomain.com 8.8.8.8` can use a specified DNS server to query, bypassing the local cache.

  Third-party monitoring services: If you need to continuously monitor DNS resolution status, you can use the monitoring functions provided by DNSPod or Alibaba Cloud DNS, and set up alert rules to notify you if any node resolution is abnormal.

  Mail servers are a special case:

  If the website you are migrating involves email services (MX records), the situation becomes more complex because the fault tolerance mechanism of email systems differs from that of websites.

  If a website's HTTP request fails, a user can usually resolve the issue by refreshing the page. However, email is different—if a sent email is not received by the server, the sender may never know.

  There are several principles for handling mail server migration:

  First, reduce the TTL (Time To Live) earlier, at least 72 hours in advance.

  Second, both the old and new mail servers can be online simultaneously. By setting the priority value of the MX record, the sending server can try the new server first, with the old server serving as a backup. For example, set the priority of the new server to 10 and the old server to 20.

  Third, before retiring the old server, configure email forwarding rules. If someone sends an email to the old server, it should be automatically forwarded to the corresponding mailbox on the new server.

  Fourth, monitor the email queue. Within 48 hours of the migration, closely monitor the email queues on both the old and new servers to ensure no emails are stuck or lost.

  What if it's too late to prepare?

  The above are all "planned migration" solutions. But reality often doesn't go as planned—the server is suddenly attacked, the data center needs emergency maintenance, the provider goes out of business… You must migrate immediately; there's simply no 24 hours to reduce TTL.

  In this situation, reducing downtime is out of the question, but you can reduce "losses."

  The most common emergency solution is "global rate limiting + batch switching." You can use GeoDNS or application-layer logic to divide users into different batches, migrating only a small portion of users at a time. This way, even if a batch of users encounters problems, the impact is minimal.

  Another solution is "client-side fallback." If you have control over the client-side code (for example, if you are the app developer), you can embed multiple backup IPs or domains in the client. When access to the default domain fails, automatically try the alternative address. This change is on the client side, with minimal impact on the server side, but requires prior technical preparation.

  Post-Migration Checklist:

  DNS switching is not the end of the process. After migration, it's recommended to review the following checklist:

  Is there normal traffic in the access logs of the new server? Confirm that users have migrated.

  Is there still traffic in the access logs of the old server? If there is after 24 hours, it means some DNS caches haven't expired, or some users have hardcoded the domain name in their configuration files.

  Has the SSL certificate been deployed to the new server? Many people forget to include the certificate after migration, causing users to see certificate errors.

  Have the API caller, callback address, OAuth callback, and payment notification address been updated? These are often hardcoded and easily overlooked.

  Are the search engine crawling records normal? Check with webmaster tools to avoid indexing anomalies caused by migration.

  Lossless DNS resolution replacement doesn't have a "one-click" magic trick. It's a complex system requiring careful planning before migration, meticulous operation during migration, and thorough verification afterward.

  The most common mistake is underestimating the power of DNS caching. You might think that changing the configuration is enough, only to find users complaining about inaccessibility the next day. It's not the users' problem; your TTL (Time To Live) wasn't reduced.

  Therefore, remember this: DNS migration isn't about changing a single record; it's about changing an entire ecosystem. Reducing TTL beforehand, operating on a dual-track system, monitoring propagation, and phased switching—using these combined strategies is the only way to achieve truly "lossless" migration.

DNS Anna
DNS Amy
DNS Luna
DNS NOC
Title
Email Address
Type
Information
Code
Submit