Developer Dictionary: IP Address
Tags: beginners, computerscience, codenewbie, firstyearincode
Published: 2020-09-08 20:16:23

This post is part of a resource called Developer Dictionary. More about why I'm writing this [here](https://bhumimakes.com/developer-dictionary/)

***

The Internet is an interconnected network of computers. We call these computers, tablets, smart phones, mainframes, cloud servers, routers, etc. In order for these connected devices to communicate with each other, they need some sort of an address — similar to physical mailing address. All computers connected to the Internet have a unique address so that other computers can find it and exchange messages with it. The address is in a very specific numerical format and it's called the IP (Internet Protocol) Address. 

##The Numbers and Dots

If you've ever setup wifi router at home, you know there is a special address that you type into your browser's address bar to get to the router's setup page. Something like `192.168.0.1`. So what do these numbers mean?

This, so called, dot notation is a shorthand for writing a binary number. It is a way of writing 1's and 0's in a more concise human readable way. That's all there is to it. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/rs98qdjhpdv187elhfl0.jpg)

The address starting with `192.168` is a private IP address. This means that it is used internally to your home's network. It is not globally unique from all the other devices on the entire Internet. So your neighbor for example could have a router in their home with this same IP address. 

###Private vs. Public Addresses

In general IP addresses are globally unique. Each computer connected to the Internet has its own unique number. However it's not always necessary for private internal networks, like that for employees of a large corporation, to have globally unique IP addresses. One advantage of private IP addresses is that it can be used without coordinating with any external organization in charge of allocating IP addresses. 
Today, private networks are widely used. If you see any address starting with the following numbers it's a private IP address: `10`, `172.16`, or `192.168`.

Another reason we started using private addresses is that public addresses needed to be conserved. We only have so many unique numbers with the 32 bits.

So actually, how many unique IP addresses do we need and how many do we have? Do we have enough? That leads us to the story of the different versions of IP called 4 and 6 (what happened to 5 you may wonder? well IPv5 was an experimental protocol that we didn't end up using).

###IPv4 and IPv6 - Total Number of Unique IP Addresses

So how many unique IP addresses do we have with the format above? That IP address has 4 numbers separated by dots. Each of those is written with 8 binary digits or bits each. So we have 32 bits total. This means we can represent 232 IP address*. That is a total of 4,294,967,296 unique IP addresses with 32 bits. The Earth's population is ~7.5 billion. So you might think well that's not enough IP addresses to go around if every single person on earth has a computer. And you're right. 

This is one reason IPv6 was introduced around 1998. The addresses we've been talking about so far are IPv4. IPv6 uses 128 binary digits. This is a 38 digit decimal number and that's quite enough IP addresses we think. It is interesting to note in the early 1980s when IPv4 was deployed we didn't expect to have more than ~4.3 billion connected devices on Earth.

Today both IPv4 and IPv6 are in simultaneous use.

###So Who Assigns These IP Addresses

When you connect your computer to the Internet who assigns the globally unique IP address? We know about the organization IANA (Internet Assigned Numbers Authority), the same one that is involved when you purchase domain names for your personal websites or side projects. According to Wikipedia, there are other groups involved in this coordination:

>The IP address space is managed globally by the Internet Assigned Numbers Authority (IANA), and by five regional Internet registries (RIRs) responsible in their designated territories for assignment to local Internet registries, such as Internet service providers (ISPs), and other end users.  IPv4 addresses were distributed by IANA to the RIRs in blocks of  approximately 16.8 million addresses each, but have been exhausted at  the IANA level since 2011. Only one of the RIRs still has a supply for local assignments in Africa.[6]  – Wikipedia 

This makes me wonder about physical addresses - how are street names and numbers decided within a town or a large city. What about the names of cities or states within a country. These don't have to be globally unique. But there are probably organizations, at various geographical levels, that look after these names. What about names of countries and continents and the planet even. I just looked up the etymology of the word 'earth'. Hm..interesting.
 
But I digress, as far as IP address go in the digital realm, we've covered the essence of this concept. If you've ever wondered about the significance of those numbers and dots you have to type sometimes, now you know! That's all there is to it.

You may go forth and explore something else. Remember to stay curious. 🔆 🧠  

***
*For those familiar with probability math - each digit could be either 0 or 1 so we have 2 options for each digits and there are 32 digits. Moreover each digit's value is independent of the all the other digits. In probably math this implies that we can multiply each of the individual digit's possibilities — 2 * 2 * 2 ...2. With a total of 32 2's. This give us the 2 to power of 32 above.