Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

On a Windows machine, I would like to direct all outgoing network traffic destined for one host to another (not another IP address). So for example, all requests to must go to or something like that.

What is the way to do this or what must I search for? (If I understood the correct terminology, it would make it a lot easier to search for).

(A little background on what I want to achieve: I want to set up something like UnoTelly just for myself on my machine, where requests to certain hosts are sent to an AWS Cloudfront server. For this, however, it does not suffice to resolve hostnames to different IP addresses; I must actually forward the traffic to a different host by its hostname).

share|improve this question

The simplest way to do that is to use the machine's host file:

  1. Find out the IP address of the machine you want to redirect to
  2. Edit the c:\windows\system32\drivers\etc\hosts file (yes, there is no extension) with any text editor. You might need to start the editor with a high security token (run as administrator" if UAC is enabled
  3. Add a line to the host file that read:

(where is actually the IP address of your destination machine)

Save the file, and you're done. Note, however, that this will just change the IP address of the machine that you'll connect to when using the dns host name. It will not change anything in the content of these connections so if you're using a protocol like HTTP (or SSL) where the host name is embedded into the data, the target machine might not respond properly.

share|improve this answer
Hi, like I said in my question, I don't just need to change the IP address, I need to forward to another machine by hostname. – mydoghasworms Jun 5 '13 at 15:12
just perform the name resolution in advance and then use that result. Your target machine isn't going to switch IP every 5 minutes. – Stephane Jun 5 '13 at 15:29
No, but the target machine is on a shared host. So just forwarding to that IP address doesn't help. But thanks anyway. I found another post which says that you can't do routing to a hostname: However, I think I may have the answer. I will try it out and post the results here. – mydoghasworms Jun 5 '13 at 16:25

As the following answer points out, you cannot route to a host name:

However, for my purposes, because I am interested in routing only web traffic, it seems what I can do is to make requests to certain hosts go to localhost using /etc/hosts and then use a local Apache instance and mod_rewrite to forward requests on to different hosts when the host header matches.

share|improve this answer

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.