127.0.0.1 is an address in the special class of IP addresses known as loopback addresses. In fact, any IP address that begins with 127 is a loopback address.
Network packets sent to this address are not transmitted over wire; rather, these are received directly by the same computer as input. For this network address, therefore, there is no hardware involved, just pure software.
Use for Testing and Debugging
The localhost (another name for 127.0.0.1) is used mainly for testing and debugging network software on a single computer. Furthermore, programs using inter-process communication use this address for communicating with processes on the same computer, without regard to the computer’s external IP address.
Very often, the localhost is used for testing Web applications. A client (such as a Web browser) sends a request to a Web server residing on the same machine, which then responds to the request.
Illegal Address for a Network Device
No network device can have an address with a first octet of 127. Also, packets meant for the localhost should never appear on a network, nor should any interface forward any such packet. The loopback address must not appear as the source address for a packet sent outside a single node.
Testing 127.0.0.1 Using the ping Command
Here’s how you can test the loopback address on your computer. At the command prompt, type in “ping 127.0.0.1” and press Enter. If you get a response such as “Reply from 127.0.0.1…,” then your system’s TCP/IP software is working properly. Typing in “ping localhost” should give similar results.
The Future – IPv6
127.x.y.z forms the special class of loopback addresses for IPv4. For IPv6, the IP address 0:0:0:0:0:0:0:1 is reserved for loopback.