How to block a website for free, no software needed !


If you need to block a website from a computer you can buy expensive software or even hardware. But you can forget all that and use a feature that most, if not all computers have built right in to the operating system. It’s available on Windows, Apple OSX, Linux and others, the name of this feature? The Hosts file, that’s it, a plain old text file. Is that all I hear you say! Well yes, let me explain.

As you probably know by now all computers on the Internet use IP addresses. The basic idea is that every computer needs a unique address, a bit like a postal address. This is so the data you requested or sent gets to the correct computer.
Along time ago when computers first started using IP addresses, people got a bit annoyed at having to remember IP addresses of everyone’s computers. So a system was invented for the Internet to convert IP addresses to names, and names to IP addresses. The name of the system is DNS (Domain Name System), its just like a big telephone book.

Most computers have a little IP Address telephone book located on the hard drive for converting ips to names but normally its not used, as its better to use the DNS on the internet. But, if you want to, you can still use it to block some websites.

Every time you use a browser and go to a site, the very first thing your computer will do is check the little telephone book on your computer (it’s not actually called the little telephone book, it has a much more catchy name, the “hosts file”). Wow great name, well that’s it, the hosts file.

So, you could add a website address to the hosts file and give it the ip address of the wrong computer, or the better way is to use the ip address of itself. That way the request will never go anywhere, the ip address used for the local computer is always 127.0.0.1.

It would be in a loop, so for instance, add http://www.bannedwebsite.com to the host file and it redirects to itself!

Here’s how you do it:

On a windows XP machine the hosts file is located at  :C:\WINDOWS\system32\drivers\etc\

The standard windows hosts file looks like this:

# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a ‘#’ symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

127.0.0.1       localhost

Add your site you want to ban and the hosts file could look like this:

# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a ‘#’ symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

127.0.0.1       localhost
127.0.0.1       http://www.bannedwebsite.com

Remember, anything starting with a # is ignored.

On a Mac its in the “etc” folder. To find that you need to open the Terminal application. You will also need to be logged in as root.



Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s