How to smoothly migrate a web server’s DNS from one IP address to another

apache-2.2domain-name-systemmod-proxyproxypassreverse-proxy

I currently have a domain name registered for a Linux/Apache server that I am going to replace with another on a new IP address.

Migrating the data will be relatively quick and a 5 minute disruption during that process is acceptable.

The DNS record has a TTL from 6-12 hours apparently, which I can't speed up.

What are the likely consequences of this change? Presumably users who are still looking at the old address will continue to hit the old server, while users who's dns cache has expired or is empty will see the new domain.

Is it possible to do some kind of redirect from the old server (with Apache or iptables) to the new IP? The old server can continue to run as long as necessary.

Best Answer

You can use a Reverse Proxy on the old web server. It might be a bit of work to set up, but just as long as ITS DNS is up to date you will be OK.

What will happen is:

  1. Old web server is configured to be Reverse Proxy
  2. DNS Switchover
  3. New web server serves hits from up-to-date DNS records
  4. Old web when it gets a hit, forwards the request to the correct DNS, and then outputs the content verbatim.

If you're running Apache, look into mod_proxy. If you're running IIS, look into ISAPI Rewrite to get this sort of functionality.

(note that the DNS on the old web server needs to be up to date if you want to proxy using the domain name. Otherwise, proxy it directly to the IP address and make sure that the host is listening on the IP without a hostname)