The IP address 127.0.0.1 is a special IPv4 address and is called the localhost or loopback address. All computers use this address as their own, but it does not allow computers to communicate with other devices like a real IP address does.
Networking – What are Localhost, 127.0.0.1 and Loopback in TCPIP?
All messages generated by TCP/IP application software contain IP addresses for their intended recipients. TCP/IP recognizes 127.0.0.1 as a special IP address. The protocol checks each message before sending it out onto the physical network. Then, all messages with a destination of 127.0.0.1 are automatically routed to the receiving end of the TCP/IP stack.
To enhance network security, TCP/IP also checks incoming messages arriving at routers or other network gateways and discards any messages containing loopback IP addresses. This double-check prevents a network attacker from disguising his traffic as if it were coming from a loopback address.
Application software typically uses this loopback feature for local testing purposes. Messages sent to loopback IP addresses such as 127.0.0.1 do not reach the local network. Instead, messages are sent directly to the TCP/IP and receive queues as if they came from an external source.