Difference localhost, 127.0.0.1 and three local IP

Difference localhost, 127.0.0.1 and three local IP

Difference localhost, 127.0.0.1 and local IP as follows:

1, first of all localhost is a domain name, in the past it points to the IP address 127.0.0.1. After the operating system support ipv6, it also points to the ipv6 address [:: 1].

Note: [:: 1] IPV6 is the loopback address, the equivalent of 12.7.0.01 IPV4

In Windows, this domain is predefined, it can be seen from the hosts file:

[img

In Linux, which is located in the defined / etc / hosts in which:

img

Note that this value is modified, such as turning it into 192.068.206.1, continue to ping.

2,127.0.0.1 The address is usually assigned to the loopback interface. It is a special loopback network interface (NIC understood as virtual) for network interaction between the respective native application. As long as the operating system of the network components is normal, loopback will be able to work. Windows can not see this interface, Linux in this interface called lo:

[img

Lo can be seen that the interface address 127.0.0.1. In fact the whole 127. * network are considered able to use, for example, you ping 127.0.0.2 also pass. But using 127.0.0.1 as the default address of the loopback interface is just a convention.

3, the local IP, precisely, the "local address" is not a standard term. Typically, it referred to as "physical NIC bound native network protocol address." Due to the current common network protocol, only the IPV4, IPX / Apple Tak disappeared, IPV6 still not commonplace, it usually refers only to the IP address even ipv4 address.

Extended Information :

1, 127. * entire network is often used as a default address of the loopback network interface, a routine is typically set to 127.0.0.1. This address can not be accessed on another computer, even if you want to visit, and also his visit, because each with TCP / IP protocol stack device basically localhost / 127.0.0.1.

2, the machine generally refers to the address bound to the physical or virtual IP address of the network interface, for access to other devices.

3, the last from the point of view of development, localhost is a domain name, with the nature of "www.baidu.com" almost. Not directly bind the socket, you must first turn to IP to gethostbyname binding.

4,127.0.0.1 is bound to the loopback interface address, if the server socket binding on it, your client can only access this machine.

References:

127.0.0.1- Baidu Encyclopedia

localhost- Baidu Encyclopedia

Difference localhost, 127.0.0.1 and the local IP of the three - Baidu know

Guess you like

Origin www.cnblogs.com/lucky75/p/11204866.html