Disable internet access but leave LAN working

9

12

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.

user219175

Posted 2013-04-23T12:07:45.050

Reputation: 101

You have Wireless network ? – Sepahrad Salour – 2013-04-23T12:16:23.947

What sort of environment? – Austin T French – 2013-04-23T13:58:23.237

Actually it's computer class. I would like to use iTalc (http://italc.sourceforge.net/) to issue a command to all computers to disable Internet. At same time leaving local network working. Could block Internet at router/switch level but teachers should not have access to router. Wired by cable.

– user219175 – 2013-04-24T08:09:09.007

possible duplicate of allowing local network access while blocking internet access

– Ƭᴇcʜιᴇ007 – 2013-07-15T11:19:05.800

What is a firewall? --- The other question (linked by techie007) is already closed as a dupe of this, which is mildly confusing. – Ярослав Рахматуллин – 2013-07-18T01:23:26.163

Answers

16

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

Posted 2013-04-23T12:07:45.050

Reputation: 8 812

The only catch is that if you have more than one local subnet, the computers will not be able to talk to computers in other subnet(s). – David – 2014-07-07T22:12:53.110

Another catch, on Windows 8, when you restart the machine, it automatically restores the connection – I.G. Pascual – 2015-02-11T08:52:59.010

After entering route delete 0.0.0.0 mask 0.0.0.0 in command prompt, I was still able to access the internet just fine... (Win7 64bit) – zigojacko – 2015-12-09T15:36:54.067

Just like what @I.G.Pascual said, when you restart the machine, it automatically restores the connection. . .(Win10 x64) – Seynal – 2017-12-11T09:37:42.040

1@Seynal if you want to persistent this rule, need add -p when delete. – Bill.Zhuang – 2018-04-12T06:23:22.900

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

Posted 2013-04-23T12:07:45.050

Reputation: 1 766

Even if its only specific machines, there are methods with routers that are not cheap consumer grade routers... – Austin T French – 2013-04-23T13:58:07.453

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

Posted 2013-04-23T12:07:45.050

Reputation: 368

Michael's solution works up to a point. With a VirtualBox XP machine while all the network files are available, the network attached printer doesn't work even though it shows up under printers. I.e., any attempt to print to the display network printer gets stuck in the print queue. – None – 2014-07-10T14:50:57.850

Worked great for me. This is very handy to start suspicious programs in a restricted environment so they can't phone home. – Martin Hansen – 2016-07-19T16:20:20.503