1

On Windows, I use the etc/hosts file to block some domains, for example because they are often used to serve ads. But sometimes, a program tries to connect to a blocked domain for a legitimate reason and fails. It is often unclear what is causing the program to fail at first (e.g. it could be my AV, firewall, a network issue, some other conflicting app...) and I waste time troubleshooting before finding that the hosts file is the culprit.

Is there a way to log, or perhaps receive a Windows notification, when a program attempts to reach a domain that is listed in the hosts file? Ideally it would record the timestamp, name of the program, and the domain it tried to reach.

3
  • 2
    Unlikely. You might be better off running your own authorative DNS server with customised zones, and using logging on that. Maybe DNSMasq?
    – davidgo
    Commented Apr 18, 2022 at 19:59
  • BTW, Windows ignores blocking of certain URL's in the hosts file. See petri.com/… . Commented Apr 18, 2022 at 22:08
  • Using the hosts file to block ads is a horrible way to block ads. Those domains change way to often for that approach to be effective. There also is a huge performance hit when the file is fairly large.
    – Ramhound
    Commented Apr 18, 2022 at 22:13

0

You must log in to answer this question.

Browse other questions tagged .