DNS Client Must Be Disabled
The size of the file requires the DNS Client to be disabled, otherwise the browser and ipconfig commands will appear to hang. This should be added to the readme.
(summary) services.msc --> DNS Client (right click) --> properties --> startup "automatic" should be changed to "disabled" --> reboot
EDIT: I've noticed significant delays in webpage loading and some YouTube ads began appearing that I did not experience before. As a result, I've re-enabled the DNS Client and removed hosts-file.net from the folder for my own personal use. If there's an alternate solution to the problem, I'd be glad to hear it.
@Aerodog which version of Windows are you running here?
I'm not a Windows user anymore so, if anyone has insight, please chime-in.
I'm mildly curious why a DNS cache would be sensitive to the hosts file. I would think these would be in separate layers. Anybody know?
I'm using Windows 10, but this is a well-known Windows-only issue on the hosts-file.net forums.
http://forum.hosts-file.net/viewtopic.php?f=6&t=2405
http://forum.hosts-file.net/viewtopic.php?f=6&t=4753
I haven't looked much into the reason. In the second link, a staff member of the site mentioned, "You need to disable the DNS Client service when using a large file, if not using the optimized one." Information regarding installation on Windows as well as the "optimized" file can be found here: http://hosts-file.net/?s=Download
EDIT: http://hosts-file.net/download/hosts-optimized.txt
I had this problem on Windows 8 as well. Internet didn't work anymore even after a restart. I couldn't replace hosts file with the older ("smaller") one, so I had to boot into safe mode to replace it with the old one (I made a backup hosts file).
I suppose the DNS Client service has to remain disabled (and not only temporarily disabled - while I run flushdns command) in order for the current hosts file to work properly in Windows. Are there any consequences for Windows users with disabled DNS Client service?
I just removed hosts-file.net from the repo.
One reason is it was creating problems such as this one.
But the main reason is, that hosts file doesn't have the curation activity I expect.
Better now?
Great, thanks! It's much better now, because the "huge" hosts file (together with disabled DNS Client service) actually decreased the internet speed significantly, as far as I tested it in Windows.
I have one more suggestion to further reduce the size of hosts file: remove the following three lists from the hosts, because they are all disabled anyway:
- "Windows10"
- "maybe-ads"
- "maybe-spy" (except the website
media.fastclick.netbeacuse this one is not disabled)
You could then create additional (secondary) hosts file with the upper lists only. All the entries could then be enabled. Therefore advanced users could manually add them to the "original" hosts file. All of the removed entries (300,000 websites from hosts-file.net) could also be located in this secondary hosts file.
Furher, all the "Acknowledgements" could be removed from the hosts file (they are located just before the "Hosts contributed by Steven Black"). Acknowledgements could be instead written in the file readme.md (or anywhere else).
Closing.
@Gitoffthelawn I think @StevenBlack is referring to the 11MB+ Host file which has currently 336,509 entries that breaks certain parsing or something like it did on my mobile device. Well, that ad_servers.txt is quite a good list though~ :relaxed:
@StevenBlack @Gitoffthelawn after merging ad_servers.txt hosts file have: 68,118 entries. Size: 2.3 MB
@FadeMind does this 2.3 MB merged hosts file work also on Windows without the need for disabling DNS Client service?
@lencc IDK. See: http://winhelp2002.mvps.org/hostswin7.htm and "The below does not apply to Windows 10 ... seems Microsoft has finally corrected the issue ...
Before you can install a custom HOSTS file in Win8, you will need to make a change in Windows Defender ... otherwise Defender will automatically remove your custom file and replace it with the default from Microsoft." from: http://winhelp2002.mvps.org/hostswin8.htm
I using Arch Linux, and 23 MB hosts file don't affect me... but this is extreme customizing hosts file.
@FadeMind as you do already use a huge hosts file, you might want to know about why it is better to use dnsmasq for this, and a fork of this tool, which actually does it: https://molotnikov.de/dnsmasq https://github.com/qutorial/angryhostsfile I called it differently from simply "hosts", it also serves a different purpose, then the hosts file here: it blocks A LOT more. So some more things will stop working time-to-time. In this sense the hosts file discussed here is more user-friendly
I have some feelings about all this.
What matters most to me is that our sources be actively curated so new threats are identified quickly, but also that false-positives are removed quickly.
When I was watching closely, I didn't see much active curation at hosts-file.net. I suspect one way to get an 11 mb hosts file is always cumulate, and rarely trim. Maybe hosts-file.net has scaled beyond the size where effective curation is even possible?
I think assembling all the possible sources, and producing a very large (monster) hosts file, is one way to do this. This will definitely protect you.
But I'm more interested in a solution that strikes a better balance.
I don't mind seeing the odd ad. But I don't ever want to see malware. I suspect those who first catch the sources of malware are those who actively curate their hosts files most frequently. This is just a hunch.
I fully agree with you, and understand the philosophy of the hosts file you provide here. This is why I decided to finally fork: the angry version is more paranoid and is for those who are a bit more paranoid.
For example, I do mind odd ads. Maldvertising is getting popular. I do mind trackers as well and they are not blocked enough by this hosts file. Not blocked malicious subdomains is another very serious disadvantage of the block-by-hostsfile approach vs. dnsmasq.
Now the hosts file accumulated from many source contains ~430K hosts. It blocks everything blocked by this hosts file and many hosts more. The mechanism of whitelisting and logs of dnsmasq or a browser console are there to find and unblock something occasionally wrongly blocked or useful (despite of some "bad" properties) at the moment.
In my experience, it is possible to use the web most of the time without any problems. Sometimes though, when DNS-blocking is on the way, I have to whitelist. In this sense the more paranoid approach is not the same user-friendly and comfortable.
@FadeMind could you upload this merged file online (i.e. merged current StevenBlack hosts + current ad_servers.txt hosts), so I can test it?
As regards Windows Defender and automatic replacement of custom hosts file: it is interesting that I didn't have such problems on Windows 8, despite I have always been using Windows Defender. However I have upgraded to Windows 10 recently. :) Thanks anyway for the information.
@lencc grab: hosts_merged_hosts-file.net_ads.7z.zip
Great, thank you! It works fine in Windows 10 (with enabled DNS Client).
@Gitoffthelawn thank you again for that suggestion. I've updated the readme to clarify the goals of the repo.