What is localhost? What is differenthost compared to 127.0.0.1?

A Unix system, also known as a 'loopback', can send and receive network communications for itself through a virtual network device. The computer can send messages to itself, allowing communication without network activity.

Even if all network devices are disconnected, the computer can still communicate via a network type. A Unix system, also known as a 'loopback', can send and receive network communications for itself through a virtual network device. The computer can send messages to itself, allowing communication without network activity.

What is 127.0.0.1?

127.0.0.1 is the most commonly used loopback IP address. 127.0.0.1 is part of the block (block) containing more than 16 million IP addresses used exclusively for the loopback function. A loopback allows the computer to communicate with itself while using network connection protocols.

Picture 1 of What is localhost? What is differenthost compared to 127.0.0.1?

In short, a loopback is a virtual network device that creates a network connection with just one endpoint, meaning that it starts and ends at the same device. That is your computer. In fact, the loopback device is even displayed in ipconfig with the lo name , as seen above. Loopback addresses are mainly used to troubleshoot or to access local resources via the network interface.

What is localhost?

Localhost is the term that describes a communication port connected to the original server. Localhost allows connecting the loopback network on itself, helping to simulate network connections when such a network is not available. In fact, the two concepts 'Localhost' and '127.0.0.1' are used interchangeably. However, it is important to remember that they are not exactly the same.

Picture 2 of What is localhost? What is differenthost compared to 127.0.0.1?

Before making a DNS request to translate text strings entered by a user into a navigable IP address, the operating system checks the HOSTS file for any aliases or redirection rules. On a system configured by default, 'Localhost' in a URL will resolve to 127.0.0.1 under IPv4 or :: 1 for IPv6. However, there are many other loopback addresses outside these two addresses. The block of dedicated IP addresses for loopback addresses is in the range from 127.0.0.0 to 127.255.255.255.

In most cases, Localhost will resolve to 127.0.0.1, thanks to the redirect rule in the HOSTS file, as mentioned above. But in some cases, Localhost can be mapped to another IP address. Therefore, Localhost can be pointed to any IP address in the upper block and will work exactly the same.

What is the difference between Localhost and 127.0.0.1?

On most systems, Localhost and 127.0.0.1 are functionally the same. But Localhost is the label for the IP address, but it is not an IP address itself. Localhost can be pointed to different IP addresses. In fact, Localhost can be pointed to any IP address, even an address outside of the reserved address block mentioned above. HOSTS file does not care and will not prevent you from doing this. However, that will break the important functionality on the system and make any application based on the localhost connection crash.

Picture 3 of What is localhost? What is differenthost compared to 127.0.0.1?

Address block 127 is selected for the loopback address block because this is the last A (Class A) network address block, running from the binary address value 00000001 to 01111111. In IPv6, the loopback address is the first address. , 0: 0: 0: 0: 0: 0: 0: 1, usually expressed in shortened form :: 1.

If you switch from a Windows computer to a Unix system, you can see that the loopback is actually synonymous with localhost. You can use the HOSTS file to perform loopback redirection back to 127.0.0.1, but that is only a change in form.

Update 26 May 2019
Category

System

Mac OS X

Hardware

Game

Tech info

Technology

Science

Life

Application

Electric

Program

Mobile