I often find myself accessing the Internet while travelling via either (gasp) dial-up or via a very limited data plan on a cell phone. I'd like to make sure that my laptop does not use the network connection for routine but unessential tasks [backup over VPN, uTorrent if I accidentally leave it running, etc].

Under Linux, I could easily do this using iptables. I'm looking for an easy [one click activation, or one script] way to do this under Windows XP.

Note that my machine does not run the Windows firewall [corporate policy], but a different one, and I can't modify the rules it imposes [including adding my own]. I do, however, have administrator access.



This answer suggested using Netprofiles for a similar problem:


    * Save your network settings as profiles.
    * Automatically activate wireless profiles when specified wireless connections are detected. (XP only)
    * Change IP Address, Subnet Mask, Default Gateway, Primary and Secondary DNS Servers, WINS Server, and DHCP settings with the click of a button.
    * Specifiy different mapped drives for each profile.
    * Change your default printer based on which profile you're currently using.
    * Automatically change your profile via program shortcuts created with Net Profiles.
    * Change the default homepage for Internet Explorer, Firefox, and Opera.
    * Proxy settings for Internet Explorer, Firefox, and Opera.
    * Run a user-defined list of programs when a profile is activated.
    * Maintain seperate desktop wallper for each profile.
    * Change screen resolutions and color quality when profiles are activated.
    * Can be easily translated into other languages using the enclosed XML language file. 

In this case, you could run a script that swaps in a HOSTS file (C:\Windows\system32\drivers\etc\hosts) that includes the sites you want to ignore as localhost aliases, eg:

# restrict access to certain sites without a firewall   my-ignored-site-1.com   my-ignored-site-2.com   my-ignored-site-3.com

Probably the easiest way to do this is to create two (or more) backup HOSTS files, say, HOSTS.normal and HOSTS.restricted, and put these entries in HOSTS.restricted. Then your script can copy HOSTS over with the HOSTS.restricted file when Netprofiles detects a restricted network, and another script copies HOSTS over with HOSTS.normal when Netprofiles detects a normal network.

  • Interesting. I'm still looking for a whitelist based solution instead of blacklist; after all, I'm not sure I know everything that needs to be blocked, and it would only take one mistake to use up a months worth of data, but this still looks promising. Thanks – Mikeage Oct 11 '09 at 11:30
  • hmm. do you have a list of programs that you'd want to shut down? i clued into your mention of backup-over-VPN when i mentioned restricting based on DNS. that wouldn't work for uTorrent and the like (at least not well). but the Netprofiles would let you run a kill-script as well, to close uTorrent and updater programs. – quack quixote Oct 11 '09 at 11:39
  • probably... but again, I'm afraid of missing one – Mikeage Oct 11 '09 at 16:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.