There is no place like 127.0.0.1
Posted: February 10th, 2010 | Author: Prabhas Gupte | Filed under: Knowledge | Tags: localhost | No Comments »
127.0.0.1 is the standard IP address used for a loopback network connection. If you have a web server installed on your machine, and try to connect to this address, you are immediately looped back to your own machine. The address 127.0.0.1 is also called as “localhost” which means “this computer”.
If you fire telnet or ftp command on 127.0.0.1, you will get connected to very same machine from which the command was fired. Suppose your machine’s name is ‘alchemist’. If you telnet to 127.0.0.1, you see something like this:
telnet 127.0.0.1
Trying 127.0.0.1…
Connected to alchemist
Escape character is ‘^]’
127.0.0.1 or localhost is used in place of the name of the computer to be connected. Though, 127.0.0.1 is most commonly used address for localhost, any IP address in the range 127.*.*.* should work in the same way.
Making a connection to 127.0.0.1 is the same as connecting with any other address. The only difference is that, in this case the local network interface hardware is avoided. This address is widely used by developers with intentions to test some web-based application. For IPv4 connections, the loopback address of the machine is usually assigned the address 127.0.0.1, with subnet mask 255.0.0.0.
Proper use of the address 127.0.0.1 is defined in RFC 3330 – Special Use IPv4 Addresses. It says:
127.0.0.0/8 - This block is assigned for use as the Internet host loopback address. A datagram sent by a higher level protocol to an address anywhere within this block should loop back inside the host. This is ordinarily implemented using only 127.0.0.1/32 for loopback, but no addresses within this block should ever appear on any network anywhere [RFC1700, page 5].
The IPv6 version of localhost is defined in RFC 3513 – Internet Protocol Version 6 Addressing Architecture. It is defined as ::1/128.


