10

I'm looking for a command (or command line program) to toggle (disable/enable) internet access to the outside world in Windows XP machines. It should temporarily block internet access but leave the LAN working.

I looked for ways to change the DNS, but browsers like Chrome keep their own cache. The machines are configured via DHCP.

w5m
  • 119

3 Answers3

18

It's probably the best to remove the default route to disable internet access:

route delete 0.0.0.0 mask 0.0.0.0

And to re-enable, add it back again:

route add 0.0.0.0 mask 0.0.0.0 192.168.1.1

but replace the 192.168.1.1 with the correct IP of your router (you can find out while the internet is still working by typing route print and checking the entry for 0.0.0.0).

Stefan Seidel
  • 10,855
2

You should log into the router and tell it to disconnect from the internet. Unless you only want to deny specific computers access?

VBwhatnow
  • 2,227
2

This is a popular result on Google so I just wanted to provide an alternative answer for those using Virtual Machines via VirtualBox.

  • Make sure your virtual machine is turned off.
  • Go to VirtualBox -> File -> Preferences -> Network -> Host-Only Networks -> Click the add button (The host-only network should be set automatically by VirtualBox)
  • Machine -> Settings -> Network -> Change "Attached to" setting to "Host-Only Adapter". (it should autofill the host-only network name for you)

That's it...the Virtual Machine will now be able to utilize the Host Network but will not have access to the internet.

Michael Tunnell
  • 398
  • 4
  • 5