I recently had to change the IP on one of my VPS servers, and I figured I’d share the exact process I used. The biggest misconception people have about DNS switching isn’t “how do I change the record?” — it’s understanding global DNS cache propagation. After you update an A record, different users around the world will see the new IP at different times, depending on their local ISP, upstream DNS servers, and the TTL value. If your current TTL is 3600 seconds (1 hour), some visitors could still be hitting the old server for a full hour after you make the change.
Step 1: Lower the TTL 24 Hours in Advance
This is the single most important preparation step. A lot of people skip it and then wonder why their site takes hours to fully switch over.
Log into your DNS provider (Cloudflare, Alibaba Cloud DNSPod, Spaceship, etc.) and find the A record for your domain. Change the TTL from the default 3600 or 86400 down to 300 seconds (5 minutes).
Wait one full current TTL cycle so this change spreads globally. After that, all new DNS queries will only cache for 5 minutes. When you finally flip the IP, most users worldwide will see the new server within 5 minutes.
If you don’t lower the TTL ahead of time, you’ll be stuck waiting for the original TTL value — which could easily be 1 hour or more.
Step 2: Fully Deploy and Test on the New VPS First
Before touching DNS, the new server must be completely ready and working on its own. Migrate your website files, database, SSL certificates, Nginx/Apache config — everything. Make sure the new server can run independently without any issues.
Example for database migration:
# On the old server - export
mysqldump -u root -p database_name > backup.sql
# Transfer to the new server
scp backup.sql user@new-server-ip:/root/
# On the new server - import
mysql -u root -p database_name < /root/backup.sql
Step 3: Test the New Server Locally with hosts File
Before making the DNS change public, force your own computer to point to the new IP. This lets you test everything without anyone else noticing.
On Windows, edit C:\Windows\System32\drivers\etc\hosts
On Mac/Linux, edit /etc/hosts
new-server-ip yourdomain.com
new-server-ip www.yourdomain.com
Save the file, then open your browser and visit the domain. Check that the site loads correctly, SSL works, and all features function. Once you’re done testing, delete those two lines.
Step 4: Make the Official DNS Switch
When everything checks out, go back to your DNS provider and change the A record IP from the old value to the new VPS IP.
If you’re using Cloudflare with the orange cloud proxy enabled, the switch is almost instant and Cloudflare can serve cached content during the transition. I also recommend turning on “Always Online” so Cloudflare can show a cached version if the origin is briefly unreachable.
Step 5: Verify DNS Propagation
After the change, check how the new IP is spreading globally:
Quick command-line checks:
nslookup yourdomain.com
# or
dig yourdomain.com +short
For a full worldwide view, go to whatsmydns.net or dnschecker.org, enter your domain, and watch the map. Green means the node has updated to the new IP; red or yellow means it’s still on the old one.
Step 6: Keep the Old Server Running for at Least 48 Hours
This is the step most people mess up. Shutting down the old server immediately after changing DNS is a classic mistake — anyone still cached on the old IP will lose access.
Leave the old server online for 1–2 days. Monitor the access logs to see when traffic drops to zero:
tail -f /var/log/nginx/access.log
Once you stop seeing new requests, it’s safe to shut down the old VPS.
Extra Tips for Dynamic Websites
If you run an e-commerce site, user login system, or anything with form submissions, there’s a risk of data being written to two different databases during the switch. The safest approach is to put the site into maintenance mode for 10–15 minutes right before and during the DNS flip. Once you confirm traffic is hitting the new server, turn maintenance mode off.
WordPress users can use the “WP Maintenance Mode” plugin to do this quickly.
Complete Timeline
| Time | Action |
|---|---|
| 24 hours before switch | Lower TTL to 300 seconds |
| Day of switch | Complete deployment and data migration on new VPS |
| 1 hour before switch | Local hosts file testing |
| At switch time | Update A record to new IP |
| Immediately after switch | Check propagation on whatsmydns.net |
| 48 hours after switch | Monitor old server logs and shut down when traffic stops |
Follow this process and — assuming you lowered the TTL in advance — most sites will complete the switch in 5–30 minutes with almost zero downtime for users.