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

 

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" in the terminal (command prompt) 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:
Reply from 127.0.0.1: Bytes=32 Time<1ms TTL=128
Reply from 127.0.0.1: Bytes=32 Time<1ms TTL=128
Reply from 127.0.0.1: Bytes=32 Time<1ms TTL=128
Reply 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?

If "localhost" is used as URL in the browser for the call, a connection to the local PC takes place. "Localhost" is often used by developers to run or test network programs or websites on their own computer. If programs consist of a client program and a server service and both components are installed on the same device, the client can access the server service via the network protocol (TCP/IP) with the name "localhost". In addition, "localhost" can also be misused as a target for a redirect in the hosts file to block certain websites, see: Blocking certain websites: Redirecting websites.

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