Hacker News new | ask | show | jobs
by anned20 2560 days ago
This is actually sent to the IP address 0.0.0.0, it roughly means that all the traffic of the listed hosts is routed back to localhost
2 comments

In this context, it actually means a "non-routable meta-address used to designate an invalid, unknown, or non-applicable target" [1] - 127.0.0.1 is localhost, 0.0.0.0 is its own thing.

[1]: https://www.howtogeek.com/225487/what-is-the-difference-betw...

Yes, you're completely right. Mixed those 2 up.
"if a 0.0.0.0 packet falls in a forest, will it make a sound a 0.0.0.0 listener can hear?"

your link was to an informative but still sloppily written article and in this context, your summary of the article isn't clarifying.

to write clearly, people gotta stop throwing around the word localhost because at the level of n.n.n.n there are no names, only numerical addresses and localhost is a name, one defined in a text file: 127.0.0.1 points to, not localhost, but to the local host, always; localhost (the name) points to 127.0.0.1 iff it is defined to (which should be all the time).

what I learned from the article is that a local host server listening on 0.0.0.0 will listen to everthing it can hear. But the question context here is, where will a packet sent to 0.0.0.0 go?

The point that 0.0.0.0 is not routable does not answer the question because 127.0.0.1 is also not routable; however, 127.0.0.1 will arrive someplace, at the local host. The question is whether 0.0.0.0 will also arrive into "the pool o' packets", that place that packets arrive on the local host prior to their disposition being determined (a. routed out of the local tcp/ip pool o' packets, b. listened to within the local tcp/ip pool o' packets, or c. dropped on the floor) because routing isn't only what Routers do, it's what tcp/ip does within a local host. (and btw, the article also describes that 0.0.0.0 means the default routing of last resort address in the context of a route address, also not the same as a packet destination address)

0.0.0.0 ≠ localhost
Indeed. Traffic served from 0.0.0.0 can be seen from other machines. Traffic on 127.0.0.1 or localhost cannot. Important to know when you’re doing local development vs a local demo.
IP addresses with 0 as the first octet are invalid and hopefully will not be routed. I prefer them for hosts files over localhost because localhost has to wait and time out, but 0.0.0.0 will fail right away.
Not sure why Ive been downvoted. I’ve used this all the time for demoing projects. It’s like asking for port 0. You don’t get the actual 0.0.0.0 IP address, but you use a physical network instead of the loopback virtual network device. Heck; I’ve had to change this in web hosting projects as a security vs feature trade off.