It seems that Rails and Django can both start up the server binding to an IP, either
0.0.0.0, 127.0.0.1, or 192.168.1.2 <-- the last one is my local IP
are there other choices? It seems that 0.0.0.0 and 192.168.1.2 can let a Virtual PC on the same machine access this website, while 127.0.0.1 cannot.
However, if it is just the same notebook, using localhost:3000 (for Rails), then it doesn't matter. But either case, 0.0.0.0:3000 won't work.
How does it work? What are the meanings of using 0.0.0.0 vs 127.0.0.1 vs 192.168.1.2?
Therefore, localhost (127.0. 0.1) is used to establish an IP connection to the same device used by the end-user. Although using 127.0. 0.1 is the most common practice, the IPv4 network standard reserves the range 127.0.
As per Class A Network (2^31 IP address), the valid IP addresses are from 1-126 in the first octet, and 0 & 127 are not used in that class, because starting with 127 has its different kinds of uses.
Hence, the address for localhost has to be looked up or resolved, whereas using 127.0. 0.1 goes directly to that IP address. Another significant difference between localhost and 127.0. 0.1 is how the request is sent.
Binding to 0.0.0.0 means to listen to all interfaces.
Binding to 127.0.0.1 means to listen to the loopback interface.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With