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

    • Windows Sandbox is awesome and I wish more people knew about it by Usama Jawad Microsoft announced Windows Sandbox way back in 2019. This is a powerful utility that allows you to run a virtualized desktop environment inside your PC, without requiring a dedicated virtual machine (VM) and its associated image files. Windows Sandbox has various advantages over a traditional VM configuration, which makes it an amazing addition to your software toolset. I already published a guide back in 2021 explaining how you can enable Windows Sandbox in your installation. The process is pretty much the same: just check that you have enabled virtualization on your PC (the process may differ for each OEM), enable Windows Sandbox from optional features, restart your PC, and simply launch the environment from Windows Search. The entire process should take less than 30 minutes, in most cases. That said, it is important to note that Windows Sandbox is not offered for Home environments; you need Windows 10/11 Pro, Enterprise, or Education SKUs to leverage it. Since Windows Sandbox is an optional capability in the operating system, many people don't know about it at all. It's essentially a lightweight and temporary desktop environment with the kernel isolated from the host. Since it's ephemeral in nature, you lose all data in Windows Sandbox as soon as you close the environment. The power of Windows Sandbox There are a lot of benefits to using Windows Sandbox. It offers a brand-new and clean Windows environment that you can utilize to test your software or run suspicious .exe files (more on that later) from third-party sources. If you're not sure about opening an untrusted website but still want to open it for some reason, using Microsoft Edge in Windows Sandbox is probably better than running it in your primary environment. But perhaps Windows Sandbox's strengths lie in its backend architecture. The ability to launch a full-fledged OS in a matter of minutes is a huge plus. The process of installing and configuring VMs, and then finding image files for an operating system, can be very daunting, so the streamlined setup for Windows Sandbox easily beats that. In addition, the environment is quite lightweight and consumes a lower amount of RAM than traditional VMs in most scenarios. The fact that Windows Sandbox is ephemeral in nature is also a major advantage from a cybersecurity standpoint. Anything you do inside this environment only stays until that instance is open, and it's isolated from the host, making it quite secure. From Windows 11, version 24H2, you do have the option to retain the instance's resources if you trigger a restart from Windows Sandbox, but you will lose everything if you just close the example in any other way. Finally, Microsoft also offers ways to have more granular control over Windows Sandbox through an XML configuration file and Policy CSP. These have fine-grained configuration settings such as audio and video input, clipboard redirection, mapping folders, networking, and more. So, if you're conscious about running certain services even inside the sandbox, you can simply disable them. Not a silver bullet Despite its plethora of benefits, Windows Sandbox is not a silver bullet that will solve all your problems. For starters, apart from the OS SKU requirement, it has a set of hardware requirements without which you simply can't launch Windows Sandbox. This includes Arm64/AMD64 architecture, 4GB of RAM, 1GB of free space, and at least two CPU cores. These mandates aren't very steep, but they may restrict utilization for some. Next, it is important to remember that while it is better to run untrusted .exe files or open suspicious websites from within Windows Sandbox rather than your primary environment, this is not foolproof. Certain sophisticated varieties of malware may still break free from the sandbox to wreak havoc on your PC, so you should keep that risk in mind anyway. Windows Sandbox offers decent kernel isolation, but malware is evolving all the time, too. In the same vein, do note that some advanced forms of malware can also recognize that they are being run in a virtualized environment. As such, they may alter their behavior dynamically to appear harmless inside the VM and then activate malicious activities as soon as they are transferred over to your host environment. That said, both the aforementioned risks apply to a traditional VM too, so this is just something to know about, not a diss against Windows Sandbox. Also, while it's great that Windows Sandbox is ephemeral, this can be a headache if you are doing extensive testing spread out across days or weeks. You would need to keep your instance up at all times and risk losing your progress at any second. Similarly, it's not possible to run multiple instances of Windows Sandbox, so a customized setup with various environments isn't really feasible. Moreover, inbox apps from the Microsoft Store like Calculator and Notepad aren't supported right now, and there is no Microsoft Store either. Optional Windows features cannot be enabled inside the Sandbox either. Finally, Windows Sandbox only virtualizes your current OS. You can't be running Windows 11, but virtualize Windows 7 inside the sandbox through native methods. Windows Sandbox or a traditional VM? Both Windows Sandbox and traditional VMs offer similar functionalities, but with different selling points. The former is more focused on the lightweight, resource-efficient, and simplified nature of the sandbox environment, while the latter emphasizes more customization options and freedom of use. At the end of the day, whether you end up using Windows Sandbox or a traditional VM depends on your preferences and use case. If you want a persistent environment with more configurability, a traditional VM is the way to go. Still, for almost everything else, Windows Sandbox is a great option, especially due to how quickly you can spin it up. A good rule of thumb would be to give Windows Sandbox a go first, find out in a few minutes if it meets your requirements, and switch to a traditional VM installation if it doesn't. Windows Sandbox is a very handy utility overall, and it's just a shame that not many people know about it due to it being an optional feature that you need to manually enable.
    • Windows 11 is getting a useful new audio feature by Taras Buria Photo: phamtu1509 Windows 11, in its current form, does not offer a quick and easy way to play audio over more than one device. If you have a bunch of audio devices connected and you want to play music on all of them, you have to tinker with third-party software to make it work. Apparently, Microsoft wants to change that with a new feature coming soon to Windows 11. @phantomofearth, the ever-giving source of Windows insights, discovered that the latest Windows 11 preview builds have a hidden toggle in quick settings that lets you share audio to multiple devices with just a few clicks. All it takes is clicking "Shared Audio" in the control center, selecting two or more available devices, and pressing "Share." As usual, there are no official announcements yet, so details about this feature remain unknown. Still, you can probably expect the new shared audio feature to make it to a Windows 11 preview build in the near future. In other Windows Insider news, Microsoft recently revealed that one of the recent taskbar changes was pulled from the operating system due to negative feedback. The company experimented with a simplified taskbar tray area, but later decided to nuke it because people did not like it. Still, there are plenty of other features coming soon to Windows 11. Check out our recent top 10 list here. Hopefully, all of them will make it to the Stable channel soon.
    • Chinese? It sounds extremely dangerous. I’ll reconsider buying a Meta Quest 3.
    • - What's your salary? Is it more than $100k a year? - Nah, it's $100 mil a year.
    • Compared to my ear buds which are the size of a matchbox, cover a much broader frequency range, and work everywhere without setup? Yeah, still not buying this as a replacement.
  • Recent Achievements

    • First Post
      nobody9 earned a badge
      First Post
    • One Month Later
      Ricky Chan earned a badge
      One Month Later
    • First Post
      leoniDAM earned a badge
      First Post
    • Reacting Well
      Ian_ earned a badge
      Reacting Well
    • One Month Later
      Ian_ earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      505
    2. 2
      ATLien_0
      206
    3. 3
      Michael Scrip
      206
    4. 4
      Xenon
      138
    5. 5
      +FloatingFatMan
      112
  • Tell a friend

    Love Neowin? Tell a friend!