Forum Home
Press F1
 
Thread ID: 108304 2010-03-23 04:57:00 HOSTS file not working stevesumner (4849) Press F1
Post ID Timestamp Content User
869421 2010-03-23 04:57:00 Hi there,

I am trying to use the HOSTS file to block some sites but to no avail. This is on Windows XP SP3
I have:


The correct file - %SystemRoot%\System32\drivers\etc\hosts
Have not done something silly like giving the file an extension
Followed the advice on this forum: www.bleepingcomputer.com and rebooted
Disabled the DNS client service (and rebooted)
Entries are like this:
127.0.0.1 http://site.com
127.0.0.1 www.site.com (e.g. have two entries for the same site, one with http: and one with just http://


Can anyone help me?
stevesumner (4849)
869422 2010-03-23 05:08:00 Download the program HostsXpert (www.funkytoad.com)

Unzip HostsXpert.zip
It will create a folder named HostsXpert in whatever folder you extract it to.
Run HostsXpert.exe by double clicking on it.
Click the Make Writeable? button.
Click Restore Microsoft's Hosts File and then click OK.
Click the X to exit the program

Note: If your Hosts file no longer exists, you will get a warning similar to "HOSTS file does not exist, Press OK to create HOSTS file". Please select Ok if that is the case.
If you have added modifications to your hosts file, they will need to be re-added

==============================

Now, we are going to replace it with a clean one.

Download this:
www.mvps.org

Unzip (Extract) the download ...
Highlight, right-click on the included HOSTS file and select: Copy

Navigate to:
C:\windows\system32\drivers\etc\

Right-click and select: Paste
Pancake (6359)
869423 2010-03-23 05:27:00 Hi there,

Entries are like this:
127.0.0.1 http://site.com
127.0.0.1 http://www.site.com

Can anyone help me?
Should be like this:

0.0.0.0 site.com
0.0.0.0 www.site.com
fred_fish (15241)
869424 2010-03-23 05:30:00 Umm no, 127.0.0.1 should work. Why are you disabling the service? Speedy Gonzales (78)
869425 2010-03-23 05:43:00 Umm, yes.
127.0.0.1 should work as well, as long as your pc is not answering on the requested port.
It may also cause a delay while it times out waiting for a response, depending on OS.
I find 0.0.0.0 works more reliably and with no delay.
But the protocol prefix (http://) is not part of the name resolution process and should definitely be omitted from the domain name.
fred_fish (15241)
869426 2010-03-23 07:30:00 Lose the "http://" in front of your entries. The hosts file just deals in raw domain names. MushHead (10626)
869427 2010-03-23 20:45:00 I have tried all the suggestions and nothing worked. Disabled the DNS client cos some other forums suggested it, I have re-enabled it now. Tried 0.0.0.0 site.com and 0.0.0.0 www.site.com, still can navigate to those sites no problems. stevesumner (4849)
869428 2010-03-23 21:43:00 Dont put the www either just the site and put 127.0.0.1 instead of 0.0.0.0 Speedy Gonzales (78)
869429 2010-03-23 22:07:00 Hi there,

I am trying to use the HOSTS file to block some sites but to no avail. This is on Windows XP SP3
I have:


The correct file - %SystemRoot%\System32\drivers\etc\hosts
Have not done something silly like giving the file an extension
Followed the advice on this forum: www.bleepingcomputer.com and rebooted
Disabled the DNS client service (and rebooted)
Entries are like this:
127.0.0.1 http://site.com
127.0.0.1 have two entries for the same site, one with http://www" target="_blank">www.site.com (e.g. have two entries for the same site, one with http: and one with just http://


Can anyone help me?

I would suggest using a DNS service where you create your own account and have the web sites blocked you wish.
SolMiester (139)
869430 2010-03-23 22:20:00 I have tried all the suggestions and nothing worked. Disabled the DNS client cos some other forums suggested it, I have re-enabled it now. Tried 0.0.0.0 site.com and 0.0.0.0 www.site.com, still can navigate to those sites no problems.

You need to flush your DNS cache or it will just use the last cached lookup

ipconfig /flushdns
fred_fish (15241)
1 2