Local loopback is a virtual network device that a computer uses to communicate to itself. This is often used to connect to local devices and software services. Local loopback is supported by most, if not all operating systems.
IP AddressesThe IP addresses 127.0.0.0 – 127.255.255.255 are reserved for local loopback. This is a total of 16,777,216 addresses. However, it is common to use 127.0.0.1 for loopback with various services binding to this IP on different ports.It is customary to define a host for loopback known as localhost. This is hardcoded into some operating systems. Localhost can also be defined in a hosts file such as the /etc/hosts file on linux. It is possible to define other hosts for IPs bound to the local loopback device. For example, a web developer might bind their domain name to the IP 127.0.0.1 for the purposes of testing and debugging.
SecurityUsing the loopback IP for local services may have security advantages over calling a local service by traversing the internet.
BandwidthUsing the loopback IP for local services may reduce your bandwidth consumption as opposed to calling a public or private IP to access the same service.
TestingThe loopback network interface is often used for testing and diagnostics because it works when you aren't connected to a network. Operating systems typically depend on the loopback device and may not function properly without it.
ExampleA web server binds to a public IP that is open to the internet. The webserver connects to a local database that only binds to the loopback IP. The database isn't available to the internet because it doesn't bind to a public IP and its port is blocked by a firewall. This has advantages in securing the database and in reducing bandwidth consumption.
Other LoopbackLoopback is primarily a networking term. However, other devices on a host may also employee a loopback mechanism. For example, a sound device may support loopback that takes its own output and accepts it as input. This can be used to record output as if it were coming from an input device such as a microphone.
This is the complete list of articles we have written about networking.
If you enjoyed this page, please consider bookmarking Simplicable.
© 2010-2023 Simplicable. All Rights Reserved. Reproduction of materials found on this site, in any form, without explicit permission is prohibited.
View credits & copyrights or citation information for this page.