1

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.

Thanks.

1 Answer 1

1

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 127.0.0.1 (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.

7
  • Can you please show me an example? I am on 192.168.90.* / 255.255.255.0 and the head-office is in 192.168.100.* / 255.255.255.0 My office router/gateway is 192.168.90.1 and the head-office gateway is 192.168.100.1. Thanks. Aug 3, 2010 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 192.168.90.1
    – JNK
    Aug 3, 2010 at 14:46
  • It tells me : ROUTE: bad gateway address gateway Aug 3, 2010 at 14:49
  • Then I'd say use the hosts file. Do you know how to do that?
    – JNK
    Aug 3, 2010 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... Aug 3, 2010 at 14:59

You must log in to answer this question.

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