Redirect request to an external IP to localhost (emulate a server)

I got an application (no source code) calling a server (hard coded IP) and expecting an answer before starting (a kind of login).

Cause the server is down half of the time, I want to create a dummy server which will emulate the behavior of the official server.

My problem:

How can I redirect the traffic to my local machine?

I want all the request send to IP w.x.y.z to be re-routed to localhost (where my dummy server is running)

More info:

  • my dummy server is an apache/php solution.
  • I tried to edit the hard coded IP in the application with an hex editor, but some checksum fail when I start the application.
  • cause the IP is hard coded in the application, I cannot use the hosts file.
  • I'm running win xp.

related: How to redirect traffic to one IP to a different IP on Windows Server 2008


This would be a total hack, but you could try assigning the IP of the server in question as an additional IP on you local interface, instructions here


Well, you could try the following:

Set up a specific route for that IP address, which will use the dummy server as gateway, like this:

route add -host w.x.y.z/32 gw dummy-server-ip

For this you will need either access to the main router for your network, or you have to do it on the machine that is sending the requests. This effectively sends the TCP packets with the w.x.y.z IP address to the MAC address of the dummy-server. So now you need to make sure the dummy server knows what to do with them.

Then add the w.x.y.z IP address as a secondary address to the dummy server.
Finally update the apache config on the dummy server to ensure it also listens on the w.x.y.z address, and make sure that the vhost on the dummy server accepts incoming requests for both the IP address and the domain name.

Please note that this will only work if there are no other routers between the requesting machine and the dummy-server. And if there are any firewalls involved, they also need updating.