Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So here is the situation, I have people using our service and they have A records in their DNS which point to an IP address that I cannot move to the new server-cluster.

This was an old set up, and moving the servers was never thought of in advance.

So, I have folks out there with A records and Cname records pointing our servers, the Cnames are not a problem, as I'll just update the DNS on our end to send those to the new cluster IP, but the A's are where I am stuck.

Is there a way with my current Centos LAMP set up to keep the old server alive, accept the IP traffic, then force it to the new IP?

THen that would buy me time to migrate everyone to the new (movable) ip ...


share|improve this question
up vote 2 down vote accepted

Yup. The easiest way I've done this is with iptables. From:

The first step is to set your Linux box to allow this kind of forwarding to take place.

# echo 1 >/proc/sys/net/ipv4/ip_forward

The next step is to tell IPTables to redirect the traffic to the new server:

# iptables -t nat -D PREROUTING -p tcp –dport 80 -j DNAT –to-destination

Here’s where the IPTables magic happens. With the third and final step we tell IPTables to rewrite the origin of connections to the new server’s port 80 to appear to come from the old server.

# iptables -t nat -D POSTROUTING -p tcp -d –dport 80 -j MASQUERADE
share|improve this answer
That looks too easy! Awesome, I'll set up a couple test cloud boxes to test that out... I was looking at a million and one things from Mod_proxy to crazy redirections... this looks perfect! – Joe Aug 29 '11 at 2:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.