20

From the book Computer Network:

The IP address 0.0.0.0, the lowest address, is used by hosts when they are being booted. It means ‘‘this network’’ or ‘‘this host.’’

... All addresses of the form 127.xx.yy.zz are reserved for loopback testing. Packets sent to that address are not put out onto the wire; they are processed locally and treated as incoming packets. This allows packets to be sent to the host without the sender knowing its number, which is useful for testing.

If I am correct, a loopback IP address refers to the current host.

What is the difference between 0.0.0.0 and a loopback IP address then?

1
  • Comments are not for extended discussion; this conversation has been moved to chat.
    – Ron Maupin
    Commented Feb 13, 2019 at 15:04

2 Answers 2

40

The statement:

The IP address 0.0.0.0 [...] means ‘‘this network’’ or ‘‘this host.’’

is misleading. It is not a "or" but "This host on this network."

From RFC1122:

{ 0, 0 }

             This host on this network.  MUST NOT be sent, except as
             a source address as part of an initialization procedure
             by which the host learns its own IP address.

The loopback address (actually any address in the 127.0.0.0/8 network) is explained in the same RFC this way:

{ 127, any }

             Internal host loopback address.  Addresses of this form
             MUST NOT appear outside a host.

So both a loopback address and the all zero address can be referred as "this host", but they have in fact very different usages:

  • the 0.0.0.0 address can be observed on a network, but only during the DHCP/BOOTP process, and only as a source address.

  • any address in the 127.0.0.0/8 can not be viewed anywhere on the network, and can only be used for:

  • testing the TCP/IP stack of the host.

  • two applications on the same host to communicate together.

A 127.X.X.X address is attached to a loopback interface. Such an interface has no underlying layer attached (i.e. it is not attached to a link layer). The packet is processed and responded to in the Internet layer. So there's really no way for this packet to reach anything outside the host.

But a packet sent from 0.0.0.0 is processed normally by the network stack, except that there's no routing decision, it is bound to the interface that is initializing, so it's sent out of this interface and goes through the link layer (which can be something else than Ethernet), then on the network.

3
  • So in other words , 0.0.0.0 from host's point of view is "self". 127 address is not a reference to a host, but more of a simulation of an external host (even though it's not in fact external). Is that correct ? The RFC also states "a datagram whose source address does not define a single host -- e.g., a zero address, a loopback address" So if I understand correctly, unlike other addresses, they aren't meant to mean an external host on the network, but serve as reference for different things - self and sort of "test" host. Commented Feb 13, 2019 at 10:40
  • Your quote is from the ICMP part. It states that an ICMP unreachable cannot be sent to a 0 address. Such an ICMP response would have to be sent to the 0 address which would violate the rule "MUST NOT be sent, except as a source address ". Also the 0 address can not be used except as part of a BOOTP/DHCP process which is broadcast in nature, so there's no point in sending an ICMP error message for a broadcast.
    – JFL
    Commented Feb 13, 2019 at 10:58
  • @SergiyKolodyazhnyy edited the answer
    – JFL
    Commented Feb 13, 2019 at 11:28
13

If I am correct, a loopback IP address refers to the current host.

No. Traffic sent to a loopback address loops back inside the host. You can send traffic to a loopback address as the destination address and then read it. This is useful in testing.

What is the difference between 0.0.0.0 and a loopback IP address then?

Addresses in the 0.0.0.0/8 network cannot be used as destination addresses. The only practical use is as a source address when a host doesn't have an address and is asking something like a DHCP server to assign it an address.


There is the IANA IPv4 Special-Purpose Address Registry that lists out all the special address blocks, and it has links to the RFCs that define each of those blocks.

1
  • Comments are not for extended discussion; this conversation has been moved to chat.
    – Ron Maupin
    Commented Feb 17, 2019 at 17:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.