HomeHow ToWhy is Localhost's IP address 127.0.0.1? What does it mean?

Why is Localhost's IP address 127.0.0.1? What does it mean?

Have you ever wondered why the IP address 127.0.0.1 is assigned as localhost? Why not some other IP address, like 121.9.1.1 or any other? The answer to this question lies in the fact that since 1981, 0 and 127 were the only reserved Class A networks. Since 0 was used to indicate a specific host, 127, the last number of the network, was left for the loopback IP address or localhost.

Why is Localhost's IP address 127.0.0.1? What does it mean?

You've probably heard of 127.0.0.1. You may also know that 127.0.0.1 points to localhost. But why is 127.0.0.1 the IP address of localhost and not something else?

Before we try to answer this question, let's talk a little about how it works. This address was used to establish a connection to the same computer used by the end user. When dealing with IPv6 addresses, it is defined to use the concept ::1: . As IPv6 addresses took over, localhost became known as 0:0:0:0:0:0:0:1.

How does 127.0.0.1 work? Why is it called that?

Very often developers use 127.0.0.1 to test their applications. When you try to establish a network connection to the 127.0.0.1 loopback address, it works the same way as making a connection to any remote device. However, it avoids connecting to the local hardware network interface.

But, why does the localhost IP address start with 127? Well, 127 is the last network number in a class A network. It has a subnet maskof255.0.0.0. So, the first assigned address on the subnet is 127.0.0.1.

However, if you use any other number of host portions, it should work fine and return 127.0.0.1. So you can ping 127.1.0.1 if you want.

You may also have wondered why the last network number was chosen for this implementation. Well, the earliest reference to 127 as a loopback dates back to the November 1986 RFC 990.And, until 1981, 0 and 127 were the only reserved Class A networks.

The Class A network number 127 is assigned to the “loopback” function, that is, a datagram sent by a higher-level protocol on a network where the 127 address was supposed to loop back to the host. No datagram “sent” to the network address 127 was ever supposed to appear on any network anywhere.

As 0 was used for a specific host, 127 was left for loopback. Some would have thought it would have made more sense to have chosen 1.0.0.0 for loopback, but it had already been given to the BBC Packet Radio Network.

You can see more on SuperUser.

📧
Subscribe to the SecNews Newsletter

The most important Security & Technology news in your Inbox.

SEARCH

FOLLOW US

📧
Newsletter SecNews
The most important Security & Technology news in your inbox.

LIVE NEWS