The localhost is a special address or hostname used to name the current host. The name localhost comes from the local and hosts words. As its name suggests it names the local host. The localhost is a hostname that should be resolved into an IP address as the computer networks work over IP addresses. Even IP addresses are dynamic and may change during the time the localhost has a static IP address which does not change for different hosts for different times. The localhost IP address is “127.0.0.1” by default.
Localhost 127.0.0.1 IP Address
The localhost is served via IP address
127.0.0.1 . The 127.0.0.1 IP address is very popular in the IT world. It is used to serve localhost for the current host. This IP adress is used to serve web applications, test connectivity with the ping command, run web services etc.
We can use the ping command in order to check current host TCP/IP protocol stack. If the ping requests are responede properly this means the current host TCP/IP protocol stack is working properly. Below we can see that the localhost is resolved into the IP address 127.0.0.1 .
$ ping localhost
Alternatively we can use the IP address 127.0.0.1 to ping check.
$ ping 127.0.0.1
Localhost 127.0.0.0/8 IP Range
Even the “127.0.0.1” is the most known and popular IP address for the localhost there is other IP address which can be used to resolve with localhost. The complete “127.0.0.0/8” IP address range is also associated with the local host. For example, the 127.2.3.4 is also resolved into the localhost.
$ ping 127.2.3.4
Localhost ::1 IPv6 Address
IPv6 also provides the localhost IP address for version 6. The
::1 is used to match with the localhost.
$ ping6 localhost
$ ping6 ::1