The IP address 127.0.0.1 is a special-purpose IPv4 address and is called the localhost or loopback address. All computers use this address as their own, but it doesn't let computers communicate with other devices as a real IP address does.
All messages generated by TCP/IP application software contain IP addresses for their intended recipients. TCP/IP recognizes 127.0.0.1 as a special IP address. The protocol checks each message before sending it to the physical network. Then, it automatically re-routes any messages with a destination of 127.0.0.1 back to the receiving end of the TCP/IP stack.
To improve network security, TCP/IP also checks incoming messages arriving on routers or other network gateways and discards any that contain loopback IP addresses. This doublecheck prevents a network attacker from disguising their traffic as coming from a loopback address.
Application software typically uses this loopback feature for local testing purposes. Messages sent to loopback IP addresses like 127.0.0.1 do not reach outside to the local area network. Instead, messages are delivered directly to the TCP/IP and receive queues as if they had arrived from an outside source.
Loopback messages contain a destination port number in addition to the address. Applications can use these port numbers to subdivide test messages into multiple categories.
Your computer might have the 192.168.1.115 private IP address assigned to it so that it can communicate with a router and other networked devices. However, it still attaches the special 127.0.0.1 address as something like an alias to mean, in networking terms, this computer.
The loopback address is only used by the computer you're on, and only for special circumstances—unlike a regular IP address that transfers files to and from other networked devices. For example, a web server running on a computer can point to 127.0.0.1 so that the pages run locally and test before it's deployed.
The name localhost also carries a special meaning in computer networking used in conjunction with 127.0.0.1. Computer operating systems maintain an entry in their HOSTS files associating a name with the loopback address. This practice helps applications create loopback messages using a name rather than a hard-coded number.
Internet Protocol v6 implements the same concept of a loopback address as IPv4. Instead of 127.0.0.01, IPv6 represents its loopback address as ::1 (0000:0000:0000:0000:0000:0000:0000:0001) and, unlike IPv4, it does not allocate a range of addresses for this purpose.
IPv4 reserves all addresses in the range 127.0.0.0 up to 127.255.255.255 for use in loopback testing, although 127.0.0.1 is (by convention) the loopback address used in almost all cases.
127.0.0.1 and other 127.0.0.0 network addresses do not belong to any of the private IP address ranges defined in IPv4. Individual addresses in those private ranges can be dedicated to local network devices and used for inter-device communication, whereas 127.0.0.1 cannot.
People studying computer networking sometimes confuse 127.0.0.1 with the 0.0.0.0. IP address. While both have special meanings in IPv4, 0.0.0.0 does not provide any loopback functionality.
Thanks for letting us know!
Tell us why!
There are a few reserved IPv4 address spaces which cannot be used on the internet. These addresses serve special purpose and cannot be routed outside the Local Area Network.
Private IP Addresses
Every class of IP, (A, B & C) has some addresses reserved as Private IP addresses. These IPs can be used within a network, campus, company and are private to it. These addresses cannot be routed on the Internet, so packets containing these private addresses are dropped by the Routers.
In order to communicate with the outside world, these IP addresses must have to be translated to some public IP addresses using NAT process, or Web Proxy server can be used.
The sole purpose to create a separate range of private addresses is to control assignment of already-limited IPv4 address pool. By using a private address range within LAN, the requirement of IPv4 addresses has globally decreased significantly. It has also helped delaying the IPv4 address exhaustion.
IP class, while using private address range, can be chosen as per the size and requirement of the organization. Larger organizations may choose class A private IP address range where smaller organizations may opt for class C. These IP addresses can be further sub-netted and assigned to departments within an organization.
Loopback IP Addresses
The IP address range 127.0.0.0 – 127.255.255.255 is reserved for loopback, i.e. a Host’s self-address, also known as localhost address. This loopback IP address is managed entirely by and within the operating system. Loopback addresses, enable the Server and Client processes on a single system to communicate with each other. When a process creates a packet with destination address as loopback address, the operating system loops it back to itself without having any interference of NIC.
Data sent on loopback is forwarded by the operating system to a virtual network interface within operating system. This address is mostly used for testing purposes like client-server architecture on a single machine. Other than that, if a host machine can successfully ping 127.0.0.1 or any IP from loopback range, implies that the TCP/IP software stack on the machine is successfully loaded and working.
In case a host is not able to acquire an IP address from the DHCP server and it has not been assigned any IP address manually, the host can assign itself an IP address from a range of reserved Link-local addresses. Link local address ranges from 169.254.0.0 -- 169.254.255.255.
Assume a network segment where all systems are configured to acquire IP addresses from a DHCP server connected to the same network segment. If the DHCP server is not available, no host on the segment will be able to communicate to any other. Windows (98 or later), and Mac OS (8.0 or later) supports this functionality of self-configuration of Link-local IP address. In absence of DHCP server, every host machine randomly chooses an IP address from the above mentioned range and then checks to ascertain by means of ARP, if some other host also has not configured itself with the same IP address. Once all hosts are using link local addresses of same range, they can communicate with each other.
These IP addresses cannot help system to communicate when they do not belong to the same physical or logical segment. These IPs are also not routable.