Trying to block a site using hosts file in windows 10, but it's not blocking


Recommended Posts

I am attempting to block a website using the hosts file in win10. I am using the format 127.0.0.1 site.name (does it mater if it's just domain.com does it need the http in front?), saving it (using notepad w/ admin privileges) and then double checking the file. I have even reset the system and it still seems to just ignore the fact that the site in question is blocked. Am I doing something incorrect, or is there something else that needs to be done?

  • Like 1
  On 16/01/2017 at 21:57, jnelsoninjax said:

I am attempting to block a website using the hosts file in win10. I am using the format 127.0.0.1 site.name, saving it (using notepad w/ admin privileges) and then double checking the file. I have even reset the system and it still seems to just ignore the fact that the site in question is blocked. Am I doing something incorrect, or is there something else that needs to be done?

Expand  

What browser are you testing this with?

Instead of 127.0.0.1, try 0.0.0.0. I currently use https://github.com/StevenBlack/hosts to filter traffic, an thats what they use. Hope it helps

  On 16/01/2017 at 22:03, kurupy said:

Instead of 127.0.0.1, try 0.0.0.0. I currently use https://github.com/StevenBlack/hosts to filter traffic, an thats what they use. Hope it helps

Expand  

I tried the 0.0.0.0 as well, I noticed that address was in the hosts file already from another program, and I tried replicating that as well, at this point IDK if the issue is that the site is cached and FF is loading the cached version or if there's something else going on.

  • Like 1
  On 16/01/2017 at 22:06, jnelsoninjax said:

I tried the 0.0.0.0 as well, I noticed that address was in the hosts file already from another program, and I tried replicating that as well, at this point IDK if the issue is that the site is cached and FF is loading the cached version or if there's something else going on.

Expand  

Try clearing the cache and attempt to visit the website again.

  On 16/01/2017 at 22:08, Circaflex said:

Try clearing the cache and attempt to visit the website again.

Expand  

No effect. Site still loads just fine. Also just a FYI the FF has no extensions installed, so there is no conflict there.

  • Like 1
  On 16/01/2017 at 22:08, sc302 said:

If I wanted to block google with a host file this is what I would do


127.0.0.1 google.com


Sent from my iPhone using Tapatalk

Expand  

That is exactly how I have it setup: 127.0.0.1 website.com I also have it as 0.0.0.0 website.com

  • Like 1
  On 16/01/2017 at 22:17, exotoxic said:

Did you try cleaning the DNS cache?

cmd --> ipconfig /flushdns

Expand  

Had not thought about that, I give it a go.

  • Like 1
  On 16/01/2017 at 22:18, jnelsoninjax said:

Had not thought about that, I give it a go.

Expand  

Again, nothing.

Tried in Edge, still goes through

  • Like 1

Why not use opendns or some other block to block the sites you don't want them or yourself to visit. There are far better solutions than to use a host file.


Sent from my iPhone using Tapatalk

  On 16/01/2017 at 22:25, Circaflex said:

Random thought, but have you tried rebooting after making the edits and attempting to visit the webpage?

Expand  

Not every time, but after initial change I rebooted the machine.

So far I have 1) Cleared the Cache 2)Flushed the DNS 3) Removed all cookies.

@sc302, I am going to do that now! I realized just as you said it that I have the router configured to use OpenDNS and Google's DNS as well, I check which one is the primary (hopefully OpenDNS)

  • Like 1
  On 16/01/2017 at 23:10, sc302 said:

If you create an account with opendns, you will be able to add your site/house/home internet and block access by category or by site name.  It is free to setup.

Expand  

Well it turns out that there is no way to set the router (Linksys WRT1900AC) to use OpenDNS, it will always default to the ISP's DNS server, which is asinine, but after some extensive research I have determined that to be the case for this router, at least until I install and open source firmware on it.

  • Like 1
  On 17/01/2017 at 00:29, jnelsoninjax said:

Well it turns out that there is no way to set the router (Linksys WRT1900AC) to use OpenDNS, it will always default to the ISP's DNS server, which is asinine, but after some extensive research I have determined that to be the case for this router, at least until I install and open source firmware on it.

Expand  

I assume you are using a static IP if that is the case? If it is dynamic, yu can use a different DNS. You do that by providing the OpenDNS IPs in the DHCP Server settings on the Local Network tab of the Connectivity page.

 

 

they also have a config page here for that router https://support.opendns.com/hc/en-us/articles/228008007-Configuration-for-Linksys-Cisco-AC175-EA6300-EA6500-EA6900-WRT1900AC

  On 17/01/2017 at 00:29, jnelsoninjax said:

Well it turns out that there is no way to set the router (Linksys WRT1900AC) to use OpenDNS, it will always default to the ISP's DNS server, which is asinine, but after some extensive research I have determined that to be the case for this router, at least until I install and open source firmware on it.

Expand  

you are looking in the wrong place.  change the dns to point to opendns in the below screenshot.

 

some give you the opportunity to change it in the internet setting tab (or whatever the equivalent terminology is in the different hardware manufacturers gui), others you change it in the local area connection, LAN or DHCP location). 

 

 

1.jpg

  On 17/01/2017 at 01:14, Circaflex said:

I assume you are using a static IP if that is the case? If it is dynamic, yu can use a different DNS. You do that by providing the OpenDNS IPs in the DHCP Server settings on the Local Network tab of the Connectivity page.

 

 

they also have a config page here for that router https://support.opendns.com/hc/en-us/articles/228008007-Configuration-for-Linksys-Cisco-AC175-EA6300-EA6500-EA6900-WRT1900AC

Expand  

Thanks for that info!

  On 17/01/2017 at 02:23, sc302 said:

you are looking in the wrong place.  change the dns to point to opendns in the below screenshot.

 

some give you the opportunity to change it in the internet setting tab (or whatever the equivalent terminology is in the different hardware manufacturers gui), others you change it in the local area connection, LAN or DHCP location). 

 

 

1.jpg

Expand  

You're correct, I was reading/looking in the wrong spot on the config page!

  • Like 1

Success! I finally got it to block the site in question via OpenDNS! Talk about a giant PITA, but I finally got it.

  • Like 3

Did you bother to do a simple test if host file entry was being used?

 

Edit host file as admin, put in your entries and then try and ping..  If this something else has been looked up recently then you would need to flush the cache..

 

This really is clickity clickity stuff.. So couple things - your browser had it cached, using a proxy so it doesn't even ask local system or dns - the proxy gets asked, etc. Your running some antivirus that prevents changes to hosts file sort of thing.. But its like 2 seconds to validate if what your putting in the host file is being used..

hostfile.png

 

blocksite.png

 

You have to make sure what your putting in the host file is what is actually being looked up too..  ie if your not going to say www.google.com then google.com would work, etc.

 

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • What? Every single app I've installed from the Microsoft Store comes from its intended developer and works perfectly fine. What apps do you install?
    • Microsoft Store is such a weird place filled with so much absolute garbage and with reputable apps that somehow come from questionable sources. Like, the app name is known, the images back it up but the publisher is just some weird name that's not mentioned for the apps we know.
    • NTLite 2025.06.10459 is out.
    • Wireshark 4.4.7 by Razvan Serea  Wireshark is a network packet analyzer. A network packet analyzer will try to capture network packets and tries to display that packet data as detailed as possible. You could think of a network packet analyzer as a measuring device used to examine what's going on inside a network cable, just like a voltmeter is used by an electrician to examine what's going on inside an electric cable (but at a higher level, of course). In the past, such tools were either very expensive, proprietary, or both. However, with the advent of Wireshark, all that has changed. Wireshark is perhaps one of the best open source packet analyzers available today. Deep inspection of hundreds of protocols, with more being added all the time Live capture and offline analysis Standard three-pane packet browser Multi-platform: Runs on Windows, Linux, OS X, Solaris, FreeBSD, NetBSD, and many others Captured network data can be browsed via a GUI, or via the TTY-mode TShark utility The most powerful display filters in the industry Rich VoIP analysis Read/write many different capture file formats Capture files compressed with gzip can be decompressed on the fly Live data can be read from Ethernet, IEEE 802.11, PPP/HDLC, ATM, Bluetooth, USB, Token Ring, Frame Relay, FDDI, and others (depending on your platfrom) Decryption support for many protocols, including IPsec, ISAKMP, Kerberos, SNMPv3, SSL/TLS, WEP, and WPA/WPA2 Coloring rules can be applied to the packet list for quick, intuitive analysis Output can be exported to XML, PostScript®, CSV, or plain text Wireshark 4.4.7 changelog: The following vulnerabilities have been fixed wnpa-sec-2025-02 Dissection engine crash. Issue 20509. CVE-2025-5601. The following bugs have been fixed Wireshark does not correctly decode LIN "go to sleep" in TECMP and CMP. Issue 20463. Dissector bug, Protocol CIGI. Issue 20496. Green power packets are not dissected when proto_version == ZBEE_VERSION_GREEN_POWER. Issue 20497. Packet diagrams misalign or drop bitfields. Issue 20507. Corruption when setting heuristic dissector table UI name from Lua. Issue 20523. LDAP dissector incorrectly displays filters with singleton "&" Issue 20527. WebSocket per-message compression extentions: fail to decompress server messages (from the 2nd) due to parameter handling. Issue 20531. The LL_PERIODIC_SYNC_WR_IND packet is not properly dissected (packet-btle.c) Issue 20554. Updated Protocol Support AT, BT LE LL, CIGI, genl, LDAP, LIN, Logcat Text, net_dm, netfilter, nvme, SSH, TCPCL, TLS, WebSocket, ZigBee, and ZigBee ZCL Download: Wireshark 4.4.7 | 83.2 MB (Open Source) Download: Portable Wireshark 4.4.7 | ARM64 Installer View: Wireshark Website | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • Snapchat finally has a watchOS app, a decade after the Apple Watch launched by David Uzondu Snap has announced that Snapchat is finally hopping onto Apple Watch, something many users have probably been waiting for. This new app lets you easily preview an incoming message right on your wrist and then fire back a reply without ever needing to grab your iPhone. For those quick responses, you have options: you can tap out a message on the keyboard, use Scribble to draw letters, dictate your reply, or just send a fitting emoji. Snap says it's trying to make Snapchat easier to use on all the different devices people have in their lives. It's already seen people using Snapchat on tablets and the web, so bringing it to wearables like the Apple Watch feels like the next natural move. That marks a big change from back in 2015 when the Apple Watch first launched. At the time, Snap took a more cautious "wait and see" approach, wanting to see if people actually used smartwatches before building an app. New app launches are not always perfect. It is still early days for the watchOS app, as some users on Reddit have reported the app being stuck on the loading screen. Hopefully, Snap will address these initial teething problems quickly. This expansion to Apple Watch comes after the company abandoned its widely criticized three-tab app redesign following a notable drop in its North American daily active users and significant negative feedback. That redesign, introduced back in September 2024, was meant to simplify things but ended up frustrating many, leading Snap to reverse course after about seven months and work on a refined five-tab layout. Meanwhile, Android smartwatch users with Wear OS are still in a different boat, as there is no official, dedicated Snapchat app for that platform yet. They can typically only receive notifications, and attempts to sideload the full Android app often result in a clunky experience.
  • Recent Achievements

    • Week One Done
      CHUNWEI earned a badge
      Week One Done
    • One Year In
      survivor303 earned a badge
      One Year In
    • Week One Done
      jbatch earned a badge
      Week One Done
    • First Post
      Yianis earned a badge
      First Post
    • Rookie
      GTRoberts went up a rank
      Rookie
  • Popular Contributors

    1. 1
      +primortal
      419
    2. 2
      +FloatingFatMan
      182
    3. 3
      snowy owl
      181
    4. 4
      ATLien_0
      174
    5. 5
      Xenon
      138
  • Tell a friend

    Love Neowin? Tell a friend!