What’s the difference between ip address 0.0.0.0 and 127.0.0.1?
listed in answer
ANSWER:
The IP address 0.0.0.0 can have very different meanings, depending on where it’s used.
- It’s not a valid address to be given to an actual network interface, along with any other address in the 0.0.0.0/8 subnet (i.e. any address starting with
0.). - It can’t be used as the source address on any IP packet, unless this happens when a computer still doesn’t know its own IP address and it’s trying to acquire one (classic example: DHCP).
- If used in a routing table, it identifies the default gateway; a route to 0.0.0.0 is the default one, i.e. the one used when there is not any more specific route available to a destination address.
- Lastly, when seen in the output of the
netstatcommand (which is what you asked for), it means that a given socket is listening on all the available IP address the computer has; when a computer has more than one IP address, a socket can be bound only to a specific address and port pair, or to a port and all addresses; if you see an IP address there, it means that socket is listening only on that port and that specific address; if you see0.0.0.0, it means it’s listening on that port on all addresses of the machine, including the loopback one (127.0.0.1).

New Comments