운영 자 발표 서비스 시 "hostname" 설정: "0.0.0.0"
What is the difference between 0.0.0.0, 127.0.0.1 and localhost
발췌:http://stackoverflow.com/questions/20778771/what-is-the-difference-between-0-0-0-0-127-0-0-1-and-localhost
127.0.0.1
is normally the IP address assigned to the "loopback" or local-only interface. This is a "fake" network adapter that can only communicate within the same host. It's often used when you want a network-capable application to only serve clients on the same host. A process that is listening on 127.0.0.1
for connections will only receive local connections on that socket. "localhost" is normally the hostname for the
127.0.0.1
IP address. It's usually set in /etc/hosts
(or the Windows equivalent named "hosts" somewhere under %WINDIR%
). You can use it just like any other hostname - try "ping localhost" to see how it resolves to 127.0.0.1
. 0.0.0.0
has a couple of different meanings, but in this context, when a server is told to listen on 0.0.0.0
that means "listen on every available network interface". The loopback adapter with IP address 127.0.0.1
from the perspective of the server process looks just like any other network adapter on the machine, so a server told to listen on 0.0.0.0
will accept connections on that interface too. That hopefully answers the IP side of your question. I'm not familiar with Jekyll or Vagrant, but I'm guessing that your port forwarding
8080 => 4000
is somehow bound to a particular network adapter, so it isn't in the path when you connect locally to 127.0.0.1
What is the IP Address 0.0.0.0?
:
http://www.howtogeek.com/225487/what-is-the-difference-between-127.0.0.1-and-0.0.0.0/
0.0.0.0 is a valid address syntax. So it should parse as valid wherever an IP address in traditional dotted-decimal notation is expected. Once parsed and converted to workable numeric form, then its value determines what happens next.
The all-zero value does have a special meaning. So it is valid, but has a meaning that may not be appropriate (and thus treated as not valid) for particular circumstances. It is basically the ‘no particular address’ placeholder. For things like address binding of network connections, the result can be to assign an appropriate interface address to the connection. If you are using it to configure an interface, it can instead remove an address from the interface. It depends on the context of use to determine what ‘no particular address’ really does.
In the context of a route entry, it usually means the default route. That happens as a result more of the address mask, which selects the bits to compare. A mask of 0.0.0.0 selects no bits, so the comparison will always succeed. So when such a route is configured, there is always somewhere for packets to go (if configured with a valid destination).
In some cases, merely ‘0’ will also work and have the same effect. But this is not guaranteed. The 0.0.0.0 form is the standard way to say ‘no particular address’ (in IPv6 that is ::0 or just ::).
Source: What is the Meaning of the IP Address 0.0.0.0?
In Internet Protocol version 4, the address 0.0.0.0 is a non-routable meta-address used to designate an invalid, unknown, or non applicable target. To give a special meaning to an otherwise invalid piece of data is an application of in-band signaling.
In the context of servers, 0.0.0.0 means all IPv4 addresses on the local machine. If a host has two IP addresses, 192.168.1.1 and 10.1.2.1, and a server running on the host listens on 0.0.0.0, it will be reachable at both of those IPs (Note: This particular text is repeated from above as part of the overall answer).
In the context of routing, 0.0.0.0 usually means the default route, i.e. the route which leads to ‘the rest of’ the Internet instead of somewhere on the local network.
Uses Include:
- The address a host claims as its own when it has not yet been assigned an address. Such as when sending the initial DHCPDISCOVER packet when using DHCP.
- The address a host assigns to itself when an address request via DHCP has failed, provided the host’s IP stack supports this. This usage has been replaced with the APIPA mechanism in modern operating systems.
- A way to specify any IPv4-host at all. It is used in this way when specifying a default route.
- A way to explicitly specify that the target is unavailable. Source: 127.0.0.1 – What Are its Uses and Why is it Important?
- A way to specify any IPv4 address at all. It is used in this way when configuring servers (i.e. when binding listening sockets). This is known to TCP programmers as INADDR_ANY. [bind(2) binds to addresses, not interfaces.]
In IPv6, the all-zeros-address is written as ::
Source: 0.0.0.0 [Wikipedia]