I've just migrated to a new server but some of the legacy code has some IPs hardcoded. Can someone tell me how to redirect requests for one IP and make them go to another?

EG. I ping and it gets redirected to

I'm using Windows Server 2008

4 Answers 4


You can do that only on a router, and you'd need quite a powerful one, too.

You just can't tell to a server "treat this IP address as if it was another one".

If your application was looking for a certain hostname, you could map that to a given IP using the HOSTS file; but redirecting one IP to another is... well... a lot more tricky.

  • 2
    The answer from MPaulo about using Netsh does exactly that very easily: it "treats an IP address like if it was another one". You need to specify each port you need redirected but you are not limited by that. It can redirect any request on a local IP address and port to a different (local or remote) IP address and port (which doesn't neet to be the same port). That should really be the answer marked as correct. Commented Sep 4, 2015 at 16:00

Use Netsh commands for Interface Portproxy: http://technet.microsoft.com/library/cc776297%28v=ws.10%29.aspx

  • 2
    This is the correct answer, it should be the one marked as correct. Commented Sep 4, 2015 at 16:01

You can add a secondary IP address to the new server. Go to control panel, network connections. Right click on the network interface and select properties. Select Internet protocol and click on properties. Click on the advanced button. Under the IP address box click add and enter the ip address for the old server.

Another option if you are using seperate networks (looks like might be based on the difference if ip address ranges) you can use a NAT router and put the old address on the WAN port and redirect the traffic to the new IP address on the LAN port.


You don't give a lot of detail but I'm assuming you mean that you have a server\service at that used to be at, right? If so, are both ip addresses allocated to your organization and do they both get routed to your network? If yes, then I think you could probably use NAT at your router/firewall to translate anything coming in for the old address to the new address.

Also, if the server\service is for web hosting, email, ftp, etc., etc. why not just change the DNS records for those resources to point to the new address?

Can you elaborate on your question?

  • Both IP's aren't routed to the same network. They are completly seperate (and ficitional in the example above) IPs. There is no DNS - just a hardcoded IP. Commented Sep 17, 2009 at 15:35
  • I realize that they're fictional and for illustrative purposes. I see you've accepted an answer, but I'll add my additional two cents anyway: If you're using DNS (which you've said you're not) you would use the hosts file to accomplish this. If you're using only the ip address you would need to come up with a way to NAT the old address to the new one.
    – joeqwerty
    Commented Sep 17, 2009 at 16:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .