There may be times when you wish to stop your browser accessing certain
One of the easiest ways of doing this is to amend
your hosts file.
Soemthing to note is that some malware and
viruses use the hosts file to stop you accessing certain sites (such
as Symantec etc) in order to stop you being to clean up your
PC, so if you are infected and cant access AV sites then its worth
checking your hosts file.
First of all you need to locate the host file on your PC, which should
be in the following directory:-
Windows 98/ME = C:\WINDOWS
Windows 2K = C:\WINNT\SYSTEM32\DRIVERS\ETC
Windows XP = C:\WINDOWS\SYSTEM32\DRIVERS\ETC
The file will simply be named "hosts" and will not have
an extension, however it can be opened in notepad.
When you open it, it will look like:-
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.
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding
# The IP address and the host name should be separated by at least
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
# For example:
# 22.214.171.124 rhino.acme.com # source server
# 126.96.36.199 x.acme.com # x client host
What you now need to do is add too the bottom of that list, below
obviously substituting the name of the websites you wish to block.
You can add as many lines as you want, but do not delete the "127.0.0.1
local host" line.
Save the changes and close notepad.
How it works.
~ Every website on the internet has an IP address.
for e.g. http://www.bbc.co.uk resolves to [188.8.131.52].
~ The hosts file is a list which ties up website addresses to an
~ Normally when we type "www.bbc.co.uk" into our browser,
unless that site is listed in the hosts file, it will use a DNS server
to look up the IP address of that website before it takes us there.
~ Now... all computers have an IP address that refers to itself
which is called the localhost, and has an IP no 127.0.0.1.
~ So by telling your hosts file that a particular websites IP is
127.0.0.1, your PC wont try to send a request to the DNS server because
it assumes it is local.
~ Therefore if you amend your hosts file to say "127.0.0.1 www.bbc.co.uk",
this would make that particular site unreachable.
How else you can use the hosts file.
You can speed up the time a website takes to load (really
only useful if on dial up), by putting the IP no of frequently
used websites next to the website address, for eg.
Because you have amended your hosts file to already have the IP for
bbc.co.uk, this saves your PC having to use a DNS server look up the