I would like to map ip address to specific localhost interfaces (e.g. 23.45.66.77 => 127.0.3.3). For named hosts I can use the hosts file. Naturally this doesn't work for IP address.

This has to work in windows, the only option I've found so far is implementing a TAP/TUN driver like openvpn does.

Are there any other options?

link|improve this question
1  
Can't you do this within routing table? – Nikolai N Fetissov May 12 '10 at 16:29
Why would you want to do this? Can you just change your software to use abcd.com instead of 23.45.66.77, that way it's easy to remap the IP? – davr May 12 '10 at 21:46
I think your answer would be you would need a transparent proxy. But how to do that in windows is a problem! this guy got squid(a web proxy) with something like a transparent proxy of some kind. markus.revti.com/2009/01/… – barlop Jan 9 '11 at 14:43
feedback

migrated from stackoverflow.com May 12 '10 at 16:34

This question came from our site for professional and enthusiast programmers.

2 Answers

You could try Windows' NAT function: netsh routing ip nat add addressmapping

C:\> netsh
netsh> routing ip nat
netsh routing ip nat> 
link|improve this answer
The following command was not found: routing ip nat – WebDevHobo May 12 '10 at 18:59
feedback

http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/route.mspx?mfr=true

Review this resource. What you want to do is route the IP address to 127.0.3.3 and make sure to set it as permanent through the -p switch if you want it to survive a reboot.

link|improve this answer
2  
Routing won't solve the problem. The destination IP address in the packets will still be 23.45.66.77, not 127.0.3.3 so the interface won't actually be able to receive the packet. – heavyd May 12 '10 at 17:30
Good point. I'll have to rethink. – Nitrodist May 12 '10 at 18:15
How about changing the ip address to that specific address through some kind of NAT based in Windows? – Nitrodist May 12 '10 at 18:22
feedback

Your Answer

 
or
required, but never shown

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