Super User is a question and answer site for computer enthusiasts and power users. 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

I'm a developer and frequently have to run some tests. I work at a branch office and the servers are located at the head-office.

The branch office and the head-office are linked together by an hardware VPN box.

It has happened once or twice already that I connected to the live servers while I actually meant to connect to a test server in my office. Every time I noticed, but it is dangerous.

What I would like to do is block outgoing packets to the subnet of the Head-Office temporarily so that I can safely run my tests without the risk of mistakenly apply changes on production servers.

I could install an personal firewall for that and block the range, but I think it may be overkill? I am thinking there may be a lighter way, with the routes command maybe?

I'm working on Windows XP.


share|improve this question
up vote 1 down vote accepted

Are the IPs the same but on different subnets? If they are you can use the route command.

If not, you can block those IPs with the hosts file in c:\windows\system32\drivers\etc.

You can add entries for the IPs that you want to keep yourself from accessing, and reroute them to (localhost) so it won't connect. You can keep 2 hosts files and just swap them out.

There's a nice tutorial on route here.

edit: I realized you could use route also even if the IPs are different, I was just hung up on the hosts file. You can use route to redirect that IP to a non-existent subnet or gateway so it won't connect and use that with a batch file.

share|improve this answer
Can you please show me an example? I am on 192.168.90.* / and the head-office is in 192.168.100.* / My office router/gateway is and the head-office gateway is Thanks. – Kharlos Dominguez Aug 3 '10 at 14:33
Actually route may not work. I am experimenting with it now but it tests your gateways. You can specify the incorrect gateway which may work, but I think you will still be able to get there. Try ROUTE ADD 192.168.100.* gateway – JNK Aug 3 '10 at 14:46
It tells me : ROUTE: bad gateway address gateway – Kharlos Dominguez Aug 3 '10 at 14:49
Then I'd say use the hosts file. Do you know how to do that? – JNK Aug 3 '10 at 14:55
Yeah, but it does not work either. To my knowledge, hosts file can only redirect host names and not IP addresses. it works to block the host name but not by IP addresses... Some tools I have to use have hard-coded IP addresses unfortunately so I can't just rely on hostname blocking... – Kharlos Dominguez Aug 3 '10 at 14:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .