Using C:\Windows\system32\drivers\etc\hosts or /etc/hosts file, it is possible to block individual hosts, by sending them to or to non-existent IP address. Example: abc.def.domain.suffix

What if I want to block all hosts under def.domain.suffix, including itself? Is it possible to use some other similar network configuration files to block them?

New contributor
hosts is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • “What if I want to block all hosts under def.domain.suffix, including itself?” - Use a software or hardware firewall – Ramhound 2 days ago

You can't do what you want within the hosts file.

The way to accomplish this is to send queries through a nameserver you control, and that provides the answers you want for the domain and its subdomains. How you do this would depend on the nameserver, but if you are at the place where you can run a combined recursive and authorative nameserver, its fairly easy and can be done multiple ways. (I know both Bind and DNSMasq can do this - the latter is commonly found on better SOHO routers and many Linux systems)

| improve this answer | |

Your Answer

hosts is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.