0.0.0.0 VS. 127.0.0.1

Using applications, configuring, problems
Post Reply
Message
Author
Mic67

0.0.0.0 VS. 127.0.0.1

#1 Post by Mic67 »

http://www.murga-linux.com/puppy/viewtopic.php?t=14372

Which was about
Hosts File - Faster web browsing

In the above discussion there was an issue of using 127.0.0.1 VS 0.0.0.0

The following may be of help/interest.

http://www.grep.be/blog/en/computer/cluebat/

0.0.0.0 VS. 127.0.0.1

"0.0.0.0 is not the same thing as 127.0.0.1. You may get the same behaviour in some cases due to some implementation details, but that does not mean that both are the same!

127.0.0.1 means "The host this software is running on". In contrast, 0.0.0.0 means "Any host"; it can be used in software as the C constant "INADDR_ANY".

While it is true that connecting to 0.0.0.0 from software such as ping will yield the same result as connecting to 127.0.0.1, it is absolutely not true that listening to 0.0.0.0 (in a bind(2) kind of way) yields the same result as listening to 127.0.0.1. After all, in the latter case you will only accept connections that originate from localhost; in the former case, you will accept any connection, whether from localhost, the local network, or the big and evil Internet.

I presume you will have at least some firewall in between, but still.

That being said, however, 127.0.0.2 is an alias for 127.0.0.1. So is 127.0.1.0. And 127.255.0.1. And, really, anything in the 127/8 network range. Now that has no utility—there can be use in having a /24 reserved for loopback, but a /8? Who would ever need 16M ip addresses for the local host? Is there even an operating system that can keep track of that many IP addresses?

Oh well. not as if I care. And, after all, IPv6 has fixed that little issue. Although it might be fair to say that they overcompensated there a little bit."
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Here is something in the /etc/readme.txt

BK 15may03:

/etc/hosts
This file has the lines:
127.0.0.1 localhost.localdomain localhost
0.0.0.0 puppypc
where second line is name of the computer. I read somewhere
that you could have:
0.0.0.0 localhost
on the second line, instead of name of the computer.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

The in the /etc/hosts
it has
127.0.0.1 localhost puppypc

And in the etc/networks
it has
loopback 127.0.0.0
###############################

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#2 Post by Flash »

Mic67, why didn't you post this in your thread about host files? Now it's an orphan. :(

Post Reply