call localhost: IP address "127.0.0.1", "::1" | what is localhost?

Diese Seite gibt es auch in Deutsch

If the computer were a house, "localhost" would be something like "home". In a nutshell, "localhost" is the network name for your own device: for itself.

DNS: localhost

The connection to another device in the network is usually established via its name (host name, domain, DNS) and the unique IP address associated with it. This applies both to the local network (LAN) and to the Internet. A computer has its own computer name (host name) and also the name "localhost", as well as the associated IP address 127.0.0.1 or, when using IPv6, the address "::1". The IP address 127.0.0.1 (or ::1) is used by the computer to establish a connection with itself. Thus, neither the IP address nor the host name must be known for a connection to the own computer. Responsible for receiving the connection is the loopback interface, which does not send the connection via the network card, but establishes it directly with the ports opened on the computer. The name localhost is reserved as a top-level domain name (TLD), this was defined in the IETF standard: tools.ietf.org/html/rfc6761 (Special-Use Domain Names) and the use of the IP address 127.0.0.1 in the document: tools.ietf.org/html/rfc5735 (Special Use IPv4 Addresses).

IP: 127.0.0.1

A test on "localhost" returns the IP address: 127.0.0.1:

C:\Users\Username>ping localhost

Ping is executed for host name [127.0.0.1] with 32 bytes of data:
Response from 127.0.0.1: Bytes=32 Time<1ms TTL=128
Response from 127.0.0.1: Bytes=32 Time<1ms TTL=128
Reply from 127.0.0.1: Bytes=32 Time<1ms TTL=128
Response from 127.0.0.1: Bytes=32 Time<1ms TTL=128

Ping statistics for 127.0.0.1:
    Packets: Sent = 4, Received = 4, Lost = 0.
    (0% loss),
Approx. times in milliseconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

For localhost to work, the IP address 127.0.0.1 must of course appear in the routing:

C:\Users>route print
===========================================================================
Interface list
 20...xx xx xx xx xx ......Ethernet Connection
  1...........................Software Loopback Interface 1
===========================================================================

IPv4 route table
===========================================================================
Active routes:
     Network destination Network mask Gateway Interface Metric
          0.0.0.0 0.0.0.0 192.168.0.1 192.168.0.22 25
...
        127.0.0.0 255.0.0.0 On connection 127.0.0.1 331
        127.0.0.1 255.255.255.255 On connection 127.0.0.1 331
  127.255.255.255 255.255 On connection 127.0.0.1 331
...
  255.255.255.255 255.255.255 On connection 127.0.0.1 331
  255.255.255.255 255.255.255 On connection 192.168.0.22 281
===========================================================================
Permanent routes:
  None

IPv6 route table
===========================================================================
Active Routes:
 If metric network destination gateway
  1 331 ::1/128 On connection
  1 331 ff00::/8 On connection
===========================================================================
Permanent routes:
  None

If you take a closer look at the routing table, you can see that not only 127.0.0.1 is used for loopback, but the complete 127.0.0.0 network, i.e. more than 16 million addresses.

For details about the routing table, see also: Adjusting the routing table: WLAN and LAN network cable at the same time - Internet access

what is "localhost" used for?

  • "localhost" is used for example by developers to run or test network programs or websites on their own computer. For the call localhost is then used as URL in the browser.
  • For programs that consist of a client and a server part and communicate via the network protocol (TCP/IP): "localhost" can then be used by the client program for communication with the server service. These programs then usually also offer the possibility that other clients can access the server service via the network, for this of course not localhost is then used, but the host name or DNS.
  • "Localhost" can also be misused as a target for redirection in the hosts file, see Blocking certain Internet pages: Redirecting web pages.
positive Bewertung({{pro_count}})
Rate Post:
{{percentage}} % positive
negative Bewertung({{con_count}})

THANK YOU for your review!



Questions / Comments


By continuing to browse the site, you agree to our use of cookies. More Details