Using IP forwarding to transfer websites to avoid downtime

opaque

Registered
Mar 12, 2005
3
0
151
The senior tech of my host when asked to transfer websites without downtime, he does it beutifully using some IPforward method altering some settings in ipalisases or iptables.

The only criteria is, the domain to be transfered must have dedicated IP.

If anyone has any idea how this is done, please share it..
 

elliotcooper

Well-Known Member
PartnerNOC
May 18, 2005
56
0
156
By far the easiest method that I have found for setting up IP forwarding is to use a package called rinetd. This will only forward TCP packets and you have to list every port that you want forwarding in the conf file but it is *way* easier than using IP tables.

First you need to install rinetd on the old server that you want to do the forwarding. This should be available via your package manager like yum . Once you have installed you need to edit the conf file e.g.:

nano -w /etc/rinetd.conf

The format for setting this up is super easy, say the IP on the old server is 1.1.1.1 and the IP that you want to forward to is 2.2.2.2 and you want to forward requests on port 80 then the config line would look like:

1.1.1.1 80 2.2.2.2 80

if you also want to add 110 and 25 then extend it to:

1.1.1.1 80 2.2.2.2 80
1.1.1.1 110 2.2.2.2 110
1.1.1.1 25 2.2.2.2 25

You can add as many as you need. When your done adding config just run:

/etc/init.d/rinetd restart

and your good to go. Any requests to the specified ports on the old IP will get forwarded to the specified port on the new IP address.
 

AdminWAY

Member
Feb 15, 2005
5
0
151
I have found simply forwarding the IP via named works fine, haven't had a problem with that at all.
 

Murtaza_t

Well-Known Member
Jan 24, 2005
476
0
166
Earth
cPanel Access Level
Website Owner
You dont need any skills to avoid downtime for any site transfer, if you have full controls on it.
The easiest way is to first transfer the site on to the new server and check it by http://IP_address/~username & just go and change the NameServer for that domain, having your site working on both the servers

Now people to whom your is DNS is propagated will see the site on new server and to those unpropagated will see the site on the old server. And finnally when DNS propagate all over you can remove it from old server.... insn't that easy.
 

elliotcooper

Well-Known Member
PartnerNOC
May 18, 2005
56
0
156
Leaving two instances of the site live is OK as long the site is not generating any data i.e. live databases, forums etc, you don't mind collecting mail from two locations for a while, you can set up two accounts with your secure payment provider, your not serving DNS from it etc etc etc. If it is doing anything more than serving some static content then I wold not reccomend leaving two instances live.
 

Murtaza_t

Well-Known Member
Jan 24, 2005
476
0
166
Earth
cPanel Access Level
Website Owner
elliotcooper said:
Leaving two instances of the site live is OK as long the site is not generating any data i.e. live databases, forums etc, you don't mind collecting mail from two locations for a while, you can set up two accounts with your secure payment provider, your not serving DNS from it etc etc etc. If it is doing anything more than serving some static content then I wold not reccomend leaving two instances live.
In this case you can just change the A record in the DNS of the old server to point to the new server..
and thanks elliotcooper, as I completely missed that.
 

elliotcooper

Well-Known Member
PartnerNOC
May 18, 2005
56
0
156
I'm not sure why updating a DNS record on the old server will help at all. If it is an authorative nameserver then you simple get the same caching problem that generated this problem in the first place. If it is not an authorative nameserver then it will make absolutely no difference to the fact that mail/web etc requests are ending up at the old server. The requests will get served as normal and lead to the duplicated site problems. If you need these erroneous requests forwarded to the new server then you should see my origional post....
 

forlinuxsupport

Well-Known Member
PartnerNOC
Dec 22, 2004
386
0
166
cPanel Access Level
Root Administrator
set TIME TO LIVE (TTL) to 60 seconds before the migration !!!

The best method is use RINETD... immediately traffic is rerouted, while DNS propergation is taking place to the new server.

That way you wont have 2 servers with inconsistent data

:)
 

sawbuck

Well-Known Member
Jan 18, 2004
1,365
10
168
cPanel Access Level
Root Administrator
Nice idea. Only caveat seems to be (other than elliotcooper's mention of being for TCP only) that rinetd won't forward ftp traffic.