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 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 in my hosts-file. Do you think this would work the same like using to block certain hosts?

  • Unless you have a web server running on localhost, you'll probably end up with the same result. (The web server might respond if it's there though). I guess would be slightly faster because your computer doesn't need to deal with the request.
    – Cas
    Dec 6, 2016 at 10:23

2 Answers 2


On Windows there is a difference: packets sent to 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 will immediately return with error code 1214 (ERROR_INVALID_NETNAME).

TL;DR: Use

  • That's what I meant. But I think this behavior is the same on all modern operating systems. I was just not sure if there is a problem with returning, because maybe some software might not be able to handle this unexpected address?
    – comfreak
    Aug 1, 2018 at 12:49

They're (usually) the same, and the packets end up the same: bombarding your own host with the requests and some time and traffic (on local interface) wasting some tiny amount of resources. (Same goes for any address in, say,

By the way it only works well if your host doesn't run the service you want to block (like using it for blocking webservers while your host does have a webserver), otherwise you will get replies from your own server. Using a definitely non-existing address (say, would prevent this but would cause delays due to unreachable host for the connections.

Blocking by firewall usually works better. :-)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .