Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

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

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

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

3 Answers 3

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

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

Use a firewall and set a rule for all traffic to that IP address to be redirected locally/refused.

You could do this per machine (Software - Windows/Other Firewall eg Kaspersky) or network wide (Hardware - Outgoing Firewall, usually Router).

share|improve this answer

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.

share|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

Your Answer

 
discard

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.