Loopback Addresses: A Computer Talks to Itself
A browser and a web server can talk on the same laptop without sending their exchange through Wi-Fi. A loopback address keeps the traffic inside the machine, taking requests from one local program to another. The computer uses its networking software to communicate with itself.
A loopback address is a special Internet Protocol (IP) address. In IP version 4, or IPv4, the familiar one is 127.0.0.1. It belongs to a whole reserved block, written 127.0.0.0/8, covering addresses that begin with 127. IP version 6, or IPv6, uses ::1 for the same local purpose.
These addresses are not unique to one person's laptop. Each computer directs loopback traffic back to itself. The IPv4 requirements and IPv6 specification require that traffic to stay inside the computer that sends it.
Why the Internet Is Running Out of Addresses
A Local Page Needs a Listener
Imagine a developer starts a web server listening on 127.0.0.1, port 8000. A browser on the same machine can request http://127.0.0.1:8000.
The loopback address selects the local computer. The port number selects the communication point where the server is waiting. A server has to be running and listening there for the browser to receive a page.
Send that address to a colleague, though, and it points somewhere else: the colleague's own computer. Their browser will look for a local service on their port 8000. The address does not lead back to the developer's laptop.
A server's listening address controls where it accepts connections. Choosing that address is called binding. Binding to loopback limits direct access from other computers. The service still needs to check what local callers are allowed to do; being on the same machine does not itself grant permission to read its data.
In Linux, binding to 0.0.0.0 instead means any local IPv4 address. That can include addresses on interfaces connected to an outside network, as the Linux IPv4 manual explains. Firewall rules and application settings still affect whether an outside connection succeeds.
Where Localhost Fits
localhost is a name used for this local destination. Software can translate it into an IPv4 or IPv6 loopback address. That translation from a name to an address is called name resolution.
The special-use rules for localhost tell name-resolution software to recognize the name and return loopback addresses, rather than send an ordinary query to another server. Like the numerical addresses, localhost leads back to the computer using it.
- Learn how networks really work, from cabling to routing, in one book.
- Prepare for the N10-009 exam with a guide written for it.
- Keep it on the shelf as a reference long after the test.
Why the Page Can Work With the Cable Unplugged
The local browser's request and the local server's reply never needed the network cable. A page that keeps working after the cable is unplugged demonstrates the local application path that was tested. It does not establish that the cable, Wi-Fi, router or internet connection works.
A ping sends a small request asking for a reply. A successful loopback ping shows that the computer answered that local request; it does not test whether the web server on port 8000 can serve a page.
Using a numerical address also skips name resolution. Even resolving localhost successfully says little about public website lookups, because localhost gets special handling. A computer can find itself by name while still failing to find a website on the internet.
IP Addresses: Why Your Device Can Have More Than One

Network Services: One Computer Asks, Another Does the Job

Sockets: How a Program Gets a Way to Communicate

QUOTE:
"Amateurs hack systems, professionals hack people."
