Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to map ip address to specific localhost interfaces (e.g. => 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 May 12 '10 at 16:34

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

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 instead of, 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.… – barlop Jan 9 '11 at 14:43

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

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

share|improve this answer
Routing won't solve the problem. The destination IP address in the packets will still be, not 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


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.