Tuesday, April 2, 2013

Hosts File

Most of the computers are linked to the internet through some sort of router. It's the box between the plug in the wall and your computer. Or for wireless, it's the box with antennas. If you go in the address bar in your browser and type 192.168.0.1 or 192.168.1.1 (see your router's manual, if don't have it you can find on the web by typing the name of the brand and the words manual and pdf) and hit enter you're gonna see your router's page.

First thing you're gonna discover is you need to change the generic password which is very easy to crack (LOL more than easy, it's a generic password, there's nothing to crack!). Second you're gonna discover that your router's firewall is on the lowest setting. Simply set your router's firewall on a higher setting (through a few clicks) (highest might give the beginner some problems) and you're gonna get rid of many on-line problems enhancing yours and everybody's security.

I say everybody's because there are too many unprotected computers out there that are used by hackers to attack others (being herded in the so-called bot-nets). Hackers send and install programs in a large number of unprotected computers that sit there and do nothing most of the time until they decide to use it against a provider like it recently happened, when they unleash hundreds of thousands of those herded unprotected computers towards a target, and their owners will probably never know.

There are a couple more things you can do besides adding a strong password. No, three. Disable remote access on your router. Disabe UPnP. Enable NAT. The're under the advanced setting page, it's all clicks. A five minute job that could save you and all of us a lot of trouble.

But a few days ago i (re)discovered on a page in my router a log containing the name of the sites i've been visiting. To my surprise, for each useful and legitimate site, they were other ten that i didn't know about. And those were about the same or similar on all different useful sites. Like doubleclick.net, etc. You can also see those sites names  in the bar in the bottom of your browser, briefly, when useful sites are loading. Try and access a major news site and look at the left bottom of your browser (i have Firefox) and see for yourself.

Then i remembered there is another page in my router where i can add sites that i wanted to block. So i added a few like doubleclick.net in there, and then suddenly i realized my computer became much faster in loading sites. As for the other useful sites, now instead of seeing so many flash advertisements i see a message in those rectangles like "Firefox can't find the server" then the name of that site. It feels so good when i see those.

However, at least on my router it is difficult to work with the block list. First, it does not accept wildcards (asterisks). That means if you have multiple web sites that have the word doubleclick in them, you have to enter them all, you cannot add only one *.doubleclick.net entry for all. Other routers might be easier to work with. Second, the visited sites list on my router does not accept select and copy commands. I have to manually enter them in the block list. Then you have to kinda guess which are the offending sites in that list and you risk blocking one that is useful. Then i kept searching on the web and found out about the hosts file.


The hosts file can contain a list of sites to be blocked within your OS, be it Windows or Linux. All i had to do was go to http://winhelp2002.mvps.org/hosts.txt, and copy and paste the content of the file onto my hosts file located in etc/hosts. According to the table above, on Windows the hosts file is in c:\windows\system32\drivers\etc\. It is named only hosts, it does not have an extension. At least on Windows XP where i tried, you have to first right click on the hosts file name (in windows explorer), go properties/advanced and uncheck the read only box before being able to edit the file. In Windows 10 is more complicated, because of user account control that simply won't let you edit the file but there is a workaround. You can copy the original hosts file (the one type "file", without the .txt extension) to desktop or documents or wherever, populate it with the file above (copy and paste will do it) then copy it back to the location that is the same as for XP above, when you will be prompted for an administrator password.

To verify that it works, i added before the first site in the list in hosts file the line "127.0.0.1  www.google.com", then saved the file, restarted the browser and voila! It blocked google too. So i know it works. Then i removed that line, of course. Can't live without google, can you! Enjoy!

No comments:

Post a Comment

Friendly comments welcome

Note: Only a member of this blog may post a comment.