Networking – Better to block a host to 0.0.0.0 than to 127.0.0.1

dnshosts-filenetworking

I have a few hosts that I would like to block in my /etc/hosts file. For that I need to define a bogus IP address that the DNS queries get resolved to.

Most of the tutorials I saw so far all mention 127.0.0.1 as the solution to that. But I was wondering if there is maybe a better or other address, that might already discard the connection earlier.

So I was thinking of using 0.0.0.0 in my hosts-file. Do you think this would work the same like using 127.0.0.1 to block certain hosts?

Best Answer

On Windows there is a difference: packets sent to 127.0.0.1 will end up bombarding whatever server you have running on your computer (and you may be running a server without knowing it), whereas trying to send packets 0.0.0.0 will immediately return with error code 1214 (ERROR_INVALID_NETNAME).

TL;DR: Use 0.0.0.0

Related Question