A Way to redirect old server to new server? w Same domain

I'm getting ready to transfer my live website from one Linode to another. I've let DNS changes propagate for a while now and lowered the TTL, so when I change the ip in the DNS records, most of the traffic should head to the new server without a problem.

However, just to be sure that everyone goes to the right server, I'd like to setup a redirect from the old server to the new one. Since the domain name won't change though, I'm wondering if there's a way to do that?

I'm looking preferably for something easy to implement on the old server so that it simply sends people to the new one, since I'm not exactly a pro with Linux (I can follow a guide without a problem though.) Once again, the domain name, content and all the urls will be the same, everything is synced, only the server will change.

Any help would be much appreciated, please include as much details as possible.

Thanks a lot,

Mathieu

7 Replies

Are your linodes in the same datacenter? if so, you can just swap IP's.

My usual approach for an IP change:

1) Drop the TTLs.

2) Add two new DNS records:

www-new.example.com IN A new.ip.address.here

www-old.example.com IN A old.ip.address.here

3) On the old web server, add a ServerAlias www-old.example.com (or your httpd's equivalent).

4) On the new web server, add a ServerAlias www-new.example.com.

5) On the new web server, put a maintenance-in-progress placeholder on example.com and www.example.com. Test using www-new.example.com, if required.

6) When the time comes, replace the old web server's configuration for example.com & www.example.com with a similar placeholder, change the example.com and www.example.com A records to point at the new IP address, then do that voodoo that you do to move everything over to the new web server.

7) As soon as you're ready to "go live" on the new server, zap the placeholder and let traffic fly. On the old server, install a redirect on example.com and www.example.com to www-new.example.com.

8) After a couple days, nuke the old instance and either make www-new.example.com go away, or redirect it to one of example.com or www.example.com depending on your canonicalization policy.

This is a "break-before-make" move; your site will be "down" for some amount of time while you copy files, move the database, and test stuff. There are ways to do this with no downtime, too, but that gets fairly specific and specialized.

glg,

I've heard of swapping ip before and yes, both Linodes are in the same datacenter, so that would be possible.

However, before choosing that, I'd like to know:

  • How long does it take to swap ip?

  • Will I need to restart the server?

  • Will the new server be live when the ip swap is done or there are any additional steps?

  • Are there any drawback(s) to this method?

Don't mind my questions, I just want to be 100% sure that the transition between the two servers goes smoothly.

Thanks!

In answer to your questions, assuming my memory is correct

  • How long does it take to swap ip? - Instant

  • Will I need to restart the server? - They both need to be shutdown to swap them

  • Will the new server be live when the ip swap is done or there are any additional steps? - Depends on your server configuration if you have a static ip configuration you will need to update this BEFORE you shutdown the server

  • Are there any drawback(s) to this method? - None that I can think of

> - Will I need to restart the server? - They both need to be shutdown to swap them
Good to know, thanks.

> - Will the new server be live when the ip swap is done or there are any additional steps? - Depends on your server configuration if you have a static ip configuration you will need to update this BEFORE you shutdown the server
I just have whatever ip was attributed to my linodes when I got them. As far as I know, that's not a static i.p, but correct me if I'm wrong.

Thanks for your help.

Ya linode assigns via dhcp by default so you should be fine, if in doubt, create two test nodes and try it out, it'll only cost you 2 days worth of whatever size linode you have.

obs,

Wonderful. Thanks a lot for your help, much appreciated.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct