views:

1099

answers:

6

we have a old and dying dedicated server. we want a new one at a new datacenter. we have a bunch of sites using the current server and don't have control of all their DNS. is there an easy way to redirect all the traffic from xx.xx.xx.xx to zz.zz.zz.zz without updating DNS records?

Thanks.

A: 

Run software on the old and dying server that would forward the traffic to the new one. In other words, via software like "iptables", turn it into a firewall.

Corey Trager
A: 

The short answer is no. Do you think that if it was possible to redirect all traffic from 208.69.34.231 to 87.248.113.14, it wouldn't have been done by now?

There are software tools that you can use to relay traffic on certain ports via xx.xx.xx.xx to zz.zz.zz.zz (tunnelling or bridging), but

  1. You'll still have to have a device at xx.xx.xx.xx
  2. The data will have to travel client->xx.xx.xx.xx.->zz.zz.zz.zz or zz.zz.zz.zz->xx.xx.xx.xx->client, and so it could be slow if the link between xx and zz is slow, or if the device at xx is slow.
David Kemp
+1 for address choice
tvanfosson
-1 for totally incorrect answer
Adam Liss
A: 

Another quick route to this would be to:

  • migrate your data to the new server
  • stop the old server
  • change the IP address of the new server to the old server
  • restart

the whole service shouldn't be offline for more than a couple minutes

edit updating DNS will certainly be faster, however; I presume you control the authoritativ entries for this server? Change the Time To Live to an absurdly low number (like an hour), update the entry, and let it roll "naturally"

warren
A: 

If you were going to keep control of the old IP address you could just use the 404 handler to re-direct pages to the new server, it's ugly, but it should be possible...

DrG
404 is "page not found; don't come back" -- a redirect means "I know what you're looking for, and it moved over there."
Adam Liss
you want 301 or a http-equiv refresh to do it this way; but dns should still beupdated
warren
+1  A: 

Judging from the IIS tag, I'm assuming you're replacing a web server. If that's the case, look into HTTP redirection. One example is here: http://www.somacon.com/p145.php

This has the advantage of "telling" your clients that your page has moved permanently.

If you're not using HTTP, Corey's iptables solution is appropriate. It can silently forward data:

iptables -t nat -I PREROUTING -p tcp -d $OLD_DEST_IP --dport $DEST_PORT -j DNAT --to $NEW_IP

Translation: in the nat (Network Address Translation) table, insert a rule in the PREROUTING chain that operates on TCP traffic to the old address:port and DNATs (changes the destination) to the same port at the new address.

Adam Liss
A: 

WOW. What a lot of answers in a short amount of time. This young community is incredible.

Yes, we are replacing web servers, and potentially switching hosting providers (hence the inability to just replace the current server with a new one on the new IP).

We host custom web-applications for a number of clients who can use their own domain names. While we'll instruct them to update their DNS records there is no guarantee of when (or if) they will so we need a temporary solution until we can assure they will.

Does anyone know the performance penalty of using something like IPTABLES, noting the 2 servers will be in physically different locations?

Kyle West
iptables uses the netfilter kernel module, and it's designed to be fast and efficient. The penalty comes from lengthening the distance each packet must travel: client -> old host -> new host, and from the delay associated with the extra hops.
Adam Liss