Yes, it is. This feature called local loopback is specially intented for the purpose you describe: it enables the applications on the same machine to communicate with each other.
Not only the 127.0.0.1
but all addresses within 127.0.0.0/8
are Special-Purpose IP Addresses reserved for local loopback. This is currently specified in RFC 8190, 2.2.2, but it dates back to at least RFC 1122, 3.2.1.3 from October 1989:
(g) { 127
, <any>
}
Internal host loopback address. Addresses of this form MUST NOT
appear outside a host.
The local loopback is typically implemented as a virtual network interface on the networking software of your operating system (e.g. lo
, lo0
on UNIX or Loopback Pseudo-Interface 1
on Windows); therefore, it doesn't even pass the packets to any network interface controller on the machine.
For completeness, there's also:
It may be used by a node to send an IPv6 packet to itself. It must
not be assigned to any physical interface.
communicate between processes on the same machine efficiently.
Traditionally, UNIX domain sockets can be either unnamed, or bound to
a filesystem pathname (marked as being of type socket). Linux also
supports an abstract namespace which is independent of the
filesystem.