Explanation of the meaning of the IP address 127.0.0.1 and the term localhost in computer networks.
READ ALSO -> What is the default Gateway: IP 192.168.1.254 or 192.168.1.1
What is the IP address 127.0.0.1?
The 127.0.0.1 address is a special IP address that identifies our own computer within the network; it is also referred to as localhost. Using this address, our computer, within a traditional LAN network, can contact itself through a program, a network client, or a browser.
What is the IP address 127.0.0.1 used for?
Through localhost (which corresponds to the IP 127.0.0.1) we can actually make “our computer talk to itself”. Obviously, this explanation is not sufficient to understand the usefulness of having an I address that actually corresponds to the same machine we are using.
Specifically, we can talk about localhost when a network service (webserver) is installed on our PC that can also be reached from the same terminal so that we can contact that specific service as if it were any remote network service. This means that localhost is very useful when we want to test websites without loading them online or we access services that have configuration panels accessible via the web page.
Examples of localhost
When we install the Plex server on our PC it is configurable via a web interface, loaded in the default browser on the operating system. When this interface is open we are not actually visiting any website, since the server is installed on the same machine: in fact, we are accessing a local server via localhost, using a unique and easily replicable address on any PC (since all PCs can use localhost).
To learn more about the use of Plex we can also read ours Complete guide to Plex, the media player with active transcoding.
Why is the term localhost used?
The address 127.0.0.1 is associated with the word localhost because this is how Windows defines it within the file hosts, a special file that we can find in folder C: WindowsSystem32driversetc.
The best users can also edit the host’s file and point a website or an IP address of a web page to 127.0.0.1: in this way, since the requested services cannot be present on our terminal, the page will not be loaded on browsers and it will not be possible to navigate on that page.
On how to use the host’s file to block web pages we suggest you read our guides Block malicious sites from the host’s file and 5 ways to edit the Hosts file like renaming sites and redirecting them.
Does 127.0.0.1 always match our computer?
The address 127.0.0.1 always corresponds to our terminal and you can never identify another computer or device on the network, also seen how a LAN network works. By analyzing well the numbers of the IP address we can see that 127 is the last number of a network with a Subnet Mask value 255.0.0.0. Class 127 has a particular function: all the IPs starting with 127 have a “loopback” function that makes the sent packets go back to the sender, without ever leaving the sending device. Within the 127 subnets then the IP address 127.0.0.1 is the first that can be assigned (127.0.0.0 cannot be used) and, since the PC in use is the only one that can “bounce its packages “, is also the only available address of this type.
Obviously, all devices that connect to a network will have their own 127.0.0.1, which can be used exclusively for local web servers or to test some network features. Finally, it is interesting to know that 127.0.0.1 is the internal address on the devices they use TCP / IP version 4 (IPv4), which is the most widespread. In recent years it has also spread to TCP / IP version 6: on this type of network, the local address corresponds to the number 0: 0: 0: 0: 0: 0: 0: 1.
If we don’t know what IPv6 is, we suggest you read our article IPv6 Internet: what it means and how to activate it.
In the end, we can say that 127.0.0.1 or localhost is a sort of “mirror” in which the PC reflects itself: if the PC “speaks” the mirror reflects its “speeches”, so as to be able to access certain functions related to the sites web or local web servers (without internet access). We often use this feature without even realizing it: If an application or service opens a web page for managing settings without accessing the Internet, we are almost certainly using localhost to take advantage of the interface, unless we use the web app with offline functionality.
If we look for more answers on home IP addresses we can also read our guides Why do computers at home have an IP address of type 192.168.XX? e What is an IP address and what is it for.