Friday, March 16, 2007

Blocking Unwanted Parasites with a Hosts File

Windows has a file called hosts, found in Windows\System32\drivers\etc\hosts, that can contain local domain name to ip conversions. It's like a local DNS service with a text database. That means that if you open the file and write then every time you try to access microsoft, the browser will redirect to your local machine, effectively making it unreachable.

You can use this to block some of the sites you don't want your child to access or whatever, but most of all, you can disable the access to sites that are known sources of unwanted ads, spyware, malware, etc. Or, as I did, disable access to sites with online games that you are addicted to :)

You can find an updated hosts file at Backup your previous hosts file, for safety, then overwrite it with this.

Update: If you have a blog on Google's Blogger, you should comment (by adding a # in front of the line) or delete the line of the hosts file relating to #[Urchin Tracking Module], else you will get some javascript errors when entering Blogger. Or you can just ignore all javascript errors.