If you have been in the computer game for awhile you know all about host files. It seems like anymore people prefer to have huge resource intensive anti-virus programs and bog down their system with programs that are supposed to protect them from getting their system bogged down. While these programs no doubt do what they are supposed (when kept up to date), there are better and less resource whoring methods to protect yourself.
I stole this form WikiPedia, but it’s basically a chart of where you can find your hostfile for whatever OS you are running.
|95, 98/98SE, Me||
|NT, 2000, and 32-bit versions of XP, 2003,Vista, 7||
|Windows Mobile||Registry key under
|AppleMacintosh||9 and earlier||System Folder: Preferences or System folder|
|Mac OS X 10.0 – 10.1.5||(Added through NetInfo or niload)|
|Mac OS X 10.2 and newer, iOS||
|Symbian||Symbian OS 6.1–9.0||
|Symbian OS 9.1+||
|iOS||iOS 2.0 and newer||
For the purposes of this article I am going to stick with Windows, since that is what I use.
Try this out, navigate to your c:windowssystem32driversetc and open your hosts file in notepad. It should look something like this:
In your host file add this line and save it:
You may need to close your web-browser or you may be able to just refresh but go to google.com now and see what happens.
What’s that? You can’t get to google anymore? Yeah, that’s because we just set your computer to point the name google.com to your home IP address so it never actually leaves your PC to try and find it. As long as this is in your host file, and your host file is active, you will never be able to reach google.com.
There are several uses for the hosts file that you can take advantage of:
- Block porn sites.
- Block known spammer sites.
- Block websites that waste time (i.e. Facebook, Twitter, this site)
You can also use your hosts file for the reverse. Let’s say you want to allow faster unrestricted access to a website. Or, let’s say your company has blocked YouTube.com from their network. Well, by simply grabbing YouTube.com‘s IP address and putting it into your hosts file and pointing it to YouTube.com you can get around it. You can either try and ping YouTube.com from the command line to get it’s IP Address (but if your company is blocking it you probably can not ping it), or you can google it and find YouTube.com‘s most common IP Addresses.
Depending on the level in which your company/school has blocked YouTube.com, this should now allow you to get to the website (or any other website you wish to use this method on).
Now I don’t promote slacking off at work, but I do promote knowing how to get around any and every obstacle put in your way. I always see any new IT blockage as a challenge to get around it. My work at one point blocked YouTube.com (actually it’s still blocked for most users) and after I received the email it took me less than a minute to use this method (and find 2 others) to get around the block and still get to YouTube.com.
This is just your basic quick guide on how to use a HOSTS file. They are extremely powerful and should not be taken lightly. This little file can literally cripple your internet if you use it wrong. But it can also give you massive amounts of control over what is allowed to be viewed on your PC.
I see this as a better blocking option than a proxy or firewall for your known bad sites because instead of your PC going out to the URL, getting it’s IP address your proxy or firewall then catching it and blocking it using the HOSTS file your PC get’s the URL and the hosts file immediately sends it to 127.0.0.1, your PC’s home address. Essentially you could also use this to send all those bad sites to google.com or something if you wanted them to point to a search engine. Just put in googles IP for that to happen.
Tomorrow I will go over the way I use my host file on my Laptop and server to keep it clean. It’s a lot easier than you think.I want to note that I am using Notepad ++ as my default text editor. I will write an article up about how great it is soon.