What does the IP address http://127.0.0.1 (localhost) mean

Solved
adonis -  
 Jean-Marie -
L'adresse IP http://127.0.0.1 désigne l'adresse de loopback de l'ordinateur local, également connue sous le nom d'interface de boucle (loopback interface). Cela signifie que tout le trafic envoyé à cette adresse IP reste à l'intérieur de l'ordinateur et n'est pas transmis sur un réseau.

La différence entre http://127.0.0.1 et http://localhost/ est essentiellement nominale. "localhost" est un nom d'hôte qui correspond à l'adresse IP 127.0.0.1. Dans la plupart des systèmes, ces deux adresses pointent vers le même endroit, mais http://localhost/ est plus facile à retenir et à utiliser pour les utilisateurs.

3 réponses

Douglas
 
Localhost or 127.0.0.1 are essentially the same. It is an address that represents the interface of the local machine (the one on which it is being called). This allows you to refer to your machine without having to know its (or their) actual IP address(es). Thus, any machine supporting the IP protocol can address localhost, even without being connected to a physical network.

This comes from the standards written by engineers that define the "rules" for the operation of the Internet.

These "standards" are called RFC (requests for comment), and there are hundreds and hundreds of pages. They are grouped by numbers.
The one explaining IP addresses (version 4) is RFC 3330 (you can read it here: https://www.ietf.org/rfc/rfc3330.txt).

The group of engineers who write these papers is called IETF (Internet Engineering Task Force).

It is noted that any packet addressed to an address starting with 127.x.x.x must be redirected to the equipment itself from which the packet is addressed. A loopback, in a way.
So this applies to, for example, the addresses 127.240.27.18, or 127.0.0.1, or 127.54.38.125, etc....

Therefore, any operating system worthy of the name must follow the "rules" defined by the IETF.

Because it is not the browser that needs to know these rules, but the TCP/IP service (or daemon) running on your operating system.
It is this last one that acts as the "station master" and directs all IP data packets to the right place.

It is this service that will receive the IP packets sent by your browser and redirect them to the correct place (on the Internet or on your own computer).

The answer to your question is therefore "no": your browser "does not need to know" that addresses starting with 127 mean "the local machine" (and in no case a machine on the Internet).
It is the TCP/IP service running on your operating system (windows, linux, mac) that is tasked with directing the packets to the right interface (your computer or a network card).

Packets addressed to an address starting with 127 will never go to the Internet.

One last remark. All of this will gradually change with the arrival of version 6 of the IP protocol. Addresses will no longer have 32 bits, but 128 bits.
And the rules will be completely different. For example, there will be no more possible broadcasts.
An IPv6 address will look like this:
2001:0db8:0000:85a3:0000:0000:ac1f:8001

Strange, right?

The loopback address (localhost) will then become:
0000:0000:0000:0000:0000:0000:0000:0001
which can be abbreviated as:
::1

For enthusiasts, you will find all the explanations of how IPv6 works here: http://livre.g6.asso.fr/index.php/Main_Page
Be careful, you need to have basic knowledge of using IPv4 addresses to understand anything (what a subnet mask (prefix) is and how to use it).
229
chris
 
Thank you for your explanation. It's very well explained. Well done.
0
bdpif
 
A little thank you from a computer science student (TAI), I finally understood!
0