Networking
In computer networking, a loopback is a virtual network interface that routes outgoing traffic back to the same device, bypassing physical hardware. The Internet Protocol (IP) reserves the entire 127.0.0.0/8 address block for loopback, with 127.0.0.1 (often called localhost) being the most commonly used address. Loopback interfaces are essential for testing network software, diagnosing protocol stacks, and enabling inter-process communication on a single host.
A loopback interface is a software-only network interface that does not correspond to any physical hardware. When a packet is sent to a loopback address, the operating system's network stack immediately routes it back to the same machine, as if it had arrived from an external source. This mechanism allows applications to communicate with each other on the same host using standard TCP/IP protocols, without requiring a network cable or wireless adapter.
The primary uses of loopback include testing network services (e.g., web servers, databases) locally, verifying that the IP stack is correctly installed and functioning, and providing a stable address for inter-process communication. Network administrators also use loopback addresses on routers to ensure management access and to establish stable router IDs for routing protocols such as OSPF and BGP.1
In IPv4, the entire 127.0.0.0/8 block (127.0.0.0 through 127.255.255.255) is reserved for loopback, as specified in RFC 6890. The most commonly used address is 127.0.0.1, often referred to as localhost. However, any address in this range is treated as loopback, and packets sent to any of them are never transmitted onto the physical network.2
In IPv6, the loopback address is ::1 (a single 1 in the last 128-bit group), defined in RFC 4291. Unlike IPv4, IPv6 reserves only this single address for loopback, not a whole block. The IPv6 loopback is used in the same way as its IPv4 counterpart, enabling local communication and testing in IPv6 networks.3
On Unix-like systems, the loopback interface is typically named lo or lo0. It is automatically configured at boot with the address 127.0.0.1 and, on IPv6-capable systems, ::1. The interface is always up, even when no physical network connection is present, because it is implemented entirely in software.
One notable behavior is that loopback traffic does not traverse any physical network, so it is not subject to network latency or packet loss. This makes it ideal for benchmarking and testing. Additionally, loopback packets are not visible to packet sniffers on other hosts, but they can be captured locally using tools like tcpdump or Wireshark with the lo interface selected. Some operating systems also support multiple loopback addresses, allowing a single host to simulate multiple network identities for testing purposes.
Beyond the common 127.0.0.1, the entire 127.0.0.0/8 block can be used for loopback. For example, 127.0.0.2 is often used to test virtual hosts on a single machine. Some software, such as the Tor anonymity network, uses loopback addresses to route traffic through local proxies, and applications like Docker use loopback to expose container ports to the host.
In routing protocols, loopback interfaces are used to define a stable router ID, which is independent of physical interface status. This ensures that routing adjacencies remain stable even if a physical link goes down. Additionally, the loopback interface is used in network management to provide a consistent source address for management protocols like SNMP and SSH, regardless of which physical interface is active.4
Another edge case: on some systems, sending a packet to 127.0.0.0 or 127.255.255.255 may behave differently; while they are technically loopback, some implementations treat them as network or broadcast addresses, leading to unexpected behavior. Also, the loopback interface is not subject to firewall rules that apply to physical interfaces unless explicitly configured, which can be a security consideration.
Loopback is a fundamental concept in networking, enabling local communication and testing without physical hardware.
Help improve the encyclopedia. Reports go straight to the site manager.