1. Click here to join our community discord server.

How to: Use the HOSTS file to **block websites** in Windows

Discussion in 'Off Topic' started by erik, Sep 11, 2012.

  1. erik

    erik MG Donor

    This is all taken from the following web article, which I think explains it best.

    http://www.overclock.net/t/44143/how-to-use-the-hosts-file-to-block-websites-in-windows

    Note: Any changes to Hosts file are VERY sensitive. You may want a third-party utility to do it for you. (I like Emsisoft HijackFree. Easy. User-friendly. Small download size. Advanced users can edit it directly at risk, or try a mid-level tool like HijackThis.)

    PAY CLOSE ATTENTION TO THE VERY LAST PARAGRAPH.

    ##########################################################################################

    Windows uses a HOSTS (located in %systemdrive%/windows/system32/drivers/etc) file to maintain a personal list of web addresses. Any time a request is made for a URL, the HOSTS file will be checked first. If a corresponding address is found you will be directed to that IP without first consulting a DNS Server. The original intent of this file was to define where sites exist; we will use it in this context to define where they don
     
  2. Don Juliano

    Don Juliano Banned

    or.....
    DNS, which stands for Domain Name System, can convert the elusive IPv4 or IPv6 addresses to meaningful names, and then translate the characters back to IP addresses. For example, when you want to visit a website, DNS will tell your web browser the real IP address of it, and then web browser will download the web page directly from that IP address.
    As you may expect, the process of translating IP addresses to website names will consume some time, which could cause access delay. Particularly, if the DNS servers are down, you will not be able to visit most websites through their URL, which isn
     
  3. Don Juliano

    Don Juliano Banned

    [h=1]How To Find IP Address Of a Domain Using Command Line In Windows[/h]
    In Windows, you can do plenty of things using command line. Converting a domain name to its IP address using the nslookup command is one of them. You can also find IP address of any website
     
  4. Sycorax

    Sycorax Member

    Oh and by the way. Microsoft screwed their users and disabled the hosts file on Windows 8 (for "security reasons". Right. Cause the host file is the only way for malware to change dns resolution ... /facepalm). So good luck on that one :P
     
  5. e36

    e36 MG Donor


    If that's the case you can use a firewall to block the site. I use Private Firewall, it's has a application and internet firewall. You can manually enter the site name or is address to block that site.
     
  6. erik

    erik MG Donor

    god that's dumb
     
  7. erik

    erik MG Donor

    Windows 8 Users - let us know if that works.... or if you're simply "locked out" of your hosts file....
     
  8. erik

    erik MG Donor

    I tried it - cool utility, but the bad of it is that it's too simple and ONLY used for that.

    EDIT: Nevermind! You can save your updates/changes, THEN re-upload them into the program if you do a fresh Windows installation or re-install HostsMan Editor. ++Has known malicious domains (updateable!); checked list; legit and quickly updated. I'll ditch HijackFree and use this from now on.

    Most endusers won't want to pile-up 3rd party utilities only used for 1 purpose each
    or
    ...get lost in the complexity of AiO (All-In-One) apps,

    So, it's a delicate balance. There are simple utilities like TXTCollector (combines notepad documents, whcih I use as a notes-taking system, into one) that I can't live without.

    EmsiSoft's Hijack Free:

    It does, though, by default, allow you FULL access to even system-level (not visible in services.msc) Services in Windows, which is dangerous if people don't know what they're doing.