127.0.0.1 vs 0.0.0.0

Which one should I use in '/etc/hosts'?
Please explain in details.

Random quotes on the topic:

The culprit may be a "black hole" firewall response, which instead of refusing connection just stonewalls it by ignoring the attempt.

1 Like

Unfortunately, 0.0.0.0 has different meanings depending on where it's used. The formal definition is given in RFC1122 Section 3.1.2.3, i.e this host on this network. Specifically, all available IP addresses on this host.

Assuming you are talking about a UNIX-like OS and not Microsoft Window, I have never seen 0.0.0.0 defined in /etc/hosts but have nearly always seen 127.0.0.1 defined. There simply is no reason to put 0.0.0.0 in /etc/hosts.

2 Likes