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

Is there a tool, that allows an individual to temporarily switch between different etc/hosts configurations, without setting up a dns?


I would like to quickly change the etc/hosts config file, so that forwards to a local IP like without changing information in our DNS server.


We are developing several bigger cms projects. The cms is developed inside a virtual machine. Sometimes we have to make bigger changes to a cms system that is already in production. A developer needs to access the productive version of the site and some minutes later he wants to redirect all requests to the local virtual machine.

A tool, that can easily swap between different etc/hosts configuration files would be ideal.

If possible don't want the users to manually edit the etc/hosts file.

share|improve this question

You could just write a batch job that could be run to swap the hosts file from one version to another when run.

share|improve this answer
Wes, this wuld work. But I have multiple projects, so the batch file could not know which of the etc/hosts configurations it should take. – Richard May 25 '11 at 17:05
Make separate .bat-file for each project – gelraen May 25 '11 at 17:28
Or if you named the hosts file the same as the project name, you could use %1 in the batch file, then set up multiple shortcuts to the same batch file, each with the target sethost.bat project1, sethost.bat project2 and so on – DerfK May 25 '11 at 17:57

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.