1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

HOSTS File.

Discussion in 'Windows - General discussion' started by Rugby101, Sep 30, 2007.

  1. Rugby101

    Rugby101 Member

    Joined:
    Apr 9, 2007
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    11
    Found one similar thread but it was of no use to me.

    Pretty much I am looking for a way to block a few specific sites so the computers on my network cannot access the said sites.

    I updated my HOSTS file a few days ago to realize that NONE of the sites listed are "blocked", but that in fact that they load without any issues.

    Can anyone please help me with the recreation of a proper HOSTS file? Or at least help diagnose the problem I am having? Please?
     
  2. rdmercer1

    rdmercer1 Active member

    Joined:
    Nov 11, 2004
    Messages:
    2,435
    Likes Received:
    0
    Trophy Points:
    66
    go into privacy settings in internet explorer and either block the sites he's visited or up your privacy and security levels
     
  3. Rugby101

    Rugby101 Member

    Joined:
    Apr 9, 2007
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    11
    I've considered that, but there are far to many holes in that idea for my liking.

    The disadvantage of using the privacy settings to block specific webpages is that can be circumvented very easily. For example (using "VampireFreaks") if I were to block www.vampirefreaks.com that would be blocked. But if you try securing the webpage (like login screens do) the website isn't blocked. And, if the person is smart enough to ping the websites IP addy the http:///69.90.230.243 isn't blocked either. If I block the IP I can block both http://www.vampirefreaks.com and http://69.90.230.243 but I can't block https://www.vampirefreaks.com

    The reason I was looking to use a HOSTS file was so I could just block the entire domain without having to block a thousand websites.

    Any way I can accomplish this by changing my IE settings, without having to block a million variations of the same URL?
     
  4. Morph416

    Morph416 Active member

    Joined:
    Jan 14, 2004
    Messages:
    1,861
    Likes Received:
    0
    Trophy Points:
    66
    One of the ways I've found to use the Hosts file to block addresses, is to make sure you use both of these:

    127.0.0.1 vampirefreaks.com
    127.0.0.1 www.vampirefreaks.com

    Using that combination, is the exact same way that Spybot Search and Destroy adds sites to the hosts file. Hasn't failed me yet. The only issues I've found, are individual webpages ending in .html, or .htm, or .asp... etc. Adding those to the hosts file didn't make any difference.
     
  5. Rugby101

    Rugby101 Member

    Joined:
    Apr 9, 2007
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    11
    Morph416

    Tried to list them as you suggested and it still isn't blocking the websites. Tried switching my localhost to 0.0.0.0 and that didn't work.

    I only have 2 entries on my HOSTS file as it as now so I am thinking there is something wrong with the way I formatted it. Any idea what is causing me this grief?

    -----

    I failed to mention this before.

    I am running XP so the HOSTS file is located in the standard location: C:\WINDOWS\system32\drivers\etc
     
  6. Morph416

    Morph416 Active member

    Joined:
    Jan 14, 2004
    Messages:
    1,861
    Likes Received:
    0
    Trophy Points:
    66
    You can't "format" a hosts file by it's general definition... but here's how I edit them.

    Right click the Hosts file and choose Rename (or you can just click once, then click again to turn it blue). Add .txt to the file extension and this will turn it into an editable notepad file.

    Open it in notepad. Down below all the crap inside the #'s section, you see:

    127.0.0.1 localhost

    Now, to add something to it, just underneath it on the next line, type in again, 127.0.0.1 (then hit the Tab button) and the web address.

    If you're having problems editing, or it won't use what you've saved, I suggest giving Spybot S&D a try. In that program, you have to go to Mode: Advanced Mode. You'll see new options open up on the left hand column, find Tools and click on it. In the main window, check the box that says Hosts File. This adds the Hosts File option to the left column. Click on it in that column. If you don't have anything in the Hosts file, the main window will only show "localhost". Look for the green + button, that says "Add Spybot S&D hosts list". When it does..... it'll add hundreds of known spyware sites so that they are not viewable by any browser. When you're done, exit Spybot.

    That makes the hosts file more manageable. Now... you should be able to follow those steps I posted above without any issues.

    After you're done adding sites to the hosts file... save it, then rename the hosts.txt file back to just "hosts" (without the quotes) by removing the .txt.

    Opening the hosts file in Notepad after you're done doing all that, may look like this:

    127.0.0.1 localhost
    # Start of entries inserted by Spybot - Search & Destroy
    # This list is Copyright 2000-2007 Safer Networking Limited

    127.0.0.1 pornotube.com
    127.0.0.1 www.pornotube.com
    127.0.0.1 babe.the-killer.bz
    127.0.0.1 www.babe.the-killer.bz
    127.0.0.1 babe.k-lined.com
    127.0.0.1 www.babe.k-lined.com
    127.0.0.1 did.i-used.cc
    127.0.0.1 www.did.i-used.cc
    127.0.0.1 coolwwwsearch.com
    127.0.0.1 www.coolwwwsearch.com
    127.0.0.1 coolwebsearch.com
    127.0.0.1 www.coolwebsearch.com
    127.0.0.1 hi.studioaperto.net
    127.0.0.1 www.hi.studioaperto.net
    127.0.0.1 wazzupnet.com
    127.0.0.1 www.wazzupnet.com
    127.0.0.1 gueb.com

    Hope all this helps! :)
     
    Last edited: Oct 1, 2007
  7. Rugby101

    Rugby101 Member

    Joined:
    Apr 9, 2007
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    11
    That is how I have edited my HOSTS file, and that is also how it appears. I do not have my HOSTS file in front of me (as I am at school and on a different computer) but my HOSTS file appears as yours does (minus the lines of text that are not “working lines” – by that I mean the SpyBOT Search and Destroy info, copyright notices, and in some cases how people sort and alphabetize their lists with headings).

    My HOSTS file essentially looks like this:

    127.0.01 localhost

    # V

    127.0.0.1 vampirefreaks.com
    127.0.0.1 www.vampirefreaks.com

    That is wherein I become perplexed because it appears to have been edited correctly (which is why I ended up posting on here)! Admittedly I did not use any programs to create the file (Like Spybot S&D or HostsXpert) but I used what I thought was the proper knowledge of the how a HOSTS file works.

    Some of my friends and coworkers alphabetize their HOSTS files like I did above (especially when they are large) and their HOSTS files work.

    I haven’t had any issues following your instructions in the least bit – although I have been confused to as why it isn’t working because as far as I can tell it is all correct. I appreciate the idiot proof instructions because with the work load with my current courses I have right now I have very little spare time.

    I will download Spybot S&D tonight and give that a shot … hopefully that will work. I will try and keep you posted… as for now back to good ol’ Marketing.
     
  8. Rugby101

    Rugby101 Member

    Joined:
    Apr 9, 2007
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    11
    Made a type-o. Forgot a period bewteen the last two segments of the IP address. Correction bellow.

    127.0.0.1
     
  9. Morph416

    Morph416 Active member

    Joined:
    Jan 14, 2004
    Messages:
    1,861
    Likes Received:
    0
    Trophy Points:
    66
    The only difference I've ever noticed, in what Spybot does and what I missed doing so the first time... was adding at least three (3) lines of space between the initial localhost entry, and the beginning of the next set. So... if you don't want to install Spybot, give that idea a try.
     
    Last edited: Oct 1, 2007
  10. Rugby101

    Rugby101 Member

    Joined:
    Apr 9, 2007
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    11
    I tried adding a few lines between my localhost entry ... no success. Then I downloaded SpyBot S&D and created a HOSTS file using that. No success.

    I am now completely dumbfounded, and at a complete loss. It seems no matter how hard people have tried to solve my problem it just doesn't work!
     
  11. DoubleDwn

    DoubleDwn Regular member

    Joined:
    Sep 27, 2005
    Messages:
    877
    Likes Received:
    0
    Trophy Points:
    26
    Once you have edited the HOSTS file, try and ping the blocked site. If it comes back with any other IP that 127.0.0.1, then you need to flush the DNS cache. From a command prompt, type 'ipconfig /flushdns'. It will clear the dns cache. Reboot and try pinging the blocked site again. See what IP comes back.

    ~Rich

    Edited: For typos
     
    Last edited: Oct 11, 2007
  12. ianski7

    ianski7 Guest

    Hey, another easier way to restrict browsing is to restrict ip/url access through your router config. Many routers have this feature and you can restrict or allow urls according to ip or netbios names of the machines in your workgroup.
     
  13. Rugby101

    Rugby101 Member

    Joined:
    Apr 9, 2007
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    11
    Thanks, Rich. Flushing the DNS worked.

    Such an amature mistake of mine too to not flush that. Really appreciate the help guys! =)
     
  14. DoubleDwn

    DoubleDwn Regular member

    Joined:
    Sep 27, 2005
    Messages:
    877
    Likes Received:
    0
    Trophy Points:
    26
    No problem, Rugby.

    Glad you got it sorted.

    ~Rich
     
  15. Rugby101

    Rugby101 Member

    Joined:
    Apr 9, 2007
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    11
    EDIT:
    Flushed DNS, and rebooted. Attempted to load the problem site and it LOADS NOW.

    I am at a complete loss right now with this HOSTS file. I've tried using the router interface, but it's a joke...

    Any ideas why this file isn't functioning properly?

     
    Last edited: Oct 20, 2007
  16. ianski7

    ianski7 Guest

    Hey, I have been fooling around with host files for the last couple of days and have run into the same problem of sometimes the page loads.
    I use IE6,7 and firefox 5 and had problems with all of them at one time.
    I now have it fixed and the site that i blocked wont load.

    This is how I fixed it.....

    Download ccleaner and winsock fix

    http://www.filehippo.com/download_ccleaner/

    http://www.snapfiles.com/get/winsockxpfix.html

    Run the ccleaner and make sure you use the cleaner and the registry tabs. Also run on the application tab which will clear browser history. Close all browsers while you do this....

    Manually delete everything in 'temp' and 'temporary internet files folders'.

    C > documents and settings> user(user account)> local settings> temp and temp internet files. Make sure your folder options are set to view hidden folders.

    Run the winsock fix..........reboot

    Delete and recreate the host file.
    Make sure every url has 2 entries
    127.0.0.1 www.junk.com
    127.0.0.1 junk.com



    If you had the same problem I did you should be good to go....good luck....
     
    Last edited by a moderator: Oct 20, 2007
  17. DoubleDwn

    DoubleDwn Regular member

    Joined:
    Sep 27, 2005
    Messages:
    877
    Likes Received:
    0
    Trophy Points:
    26
    Rugby,

    After the DNS flush, delete all temp internet files. Then reboot and try again.

    ~Rich
     

Share This Page