How to make my computer think an IP is somewhere else

1

0

I have a local app which code I do not own and tries to directly connect to some IP, let's say 123.45.67.890. For testing purposes, I would like to re-route that connection to somewhere else, another completely different IP, and hex-editing the IP in the file is not an option. How would I go about this? I can't edit the hosts file and have an effect, because there's no DNS request being performed. Solutions preferably on Windows, but I can also do it under Linux.

Délisson Junio

Posted 2013-12-27T00:21:25.897

Reputation: 127

Answers

2

I don't know how (if) you can do it under Windows, but you can use IPTables on linux to rewrite a packet using DNAT

You might want to try something like

/sbin/iptables -I PREROUTING -d 123.45.67.89 -j DNAT --to-destination 98.76.54.32

davidgo

Posted 2013-12-27T00:21:25.897

Reputation: 49 152

0

See re-routing an IP to localhost.

This method uses the netsh MS-Dos function. Specifically, you can add multiple ip addresses to your loop-back adapter. Once added, Microsoft handles calls to any addresses in the loop-back adapter, causing them to stay (i.e. loop-back) within windows, and not route to the actual IP location (Be it on your LAN or even the WAN).

Ganesh R.

Posted 2013-12-27T00:21:25.897

Reputation: 4 869

And if you need to actually forward to a different host, you can combine this with a TCP proxy running on your local machine. – Zoredache – 2013-12-27T01:59:24.013

Hm the fact is I needed to sniff the packets using Wireshark/Netmon, and they won't sniff on the loopback interface on windows. – Délisson Junio – 2013-12-27T02:17:10.690