# What is "IP"?

We'll cover the following

## IPv4

The Internet Protocol’s fourth version IPv4 was developed in the 1980s and it was designed to use 32 bits of data to define an IP address (for example, 192.168.1.1). As we can see in 192.168.1.1, there are 4 fields separated by dots, and each field of these 4 occupies 8 bits of data:

8 bits * 4 fields = 32 bits.

Now, let’s think a bit about what 32 bits entail. It tells us the maximum number of IP addresses that can be generated: $2^{32} ≈ 4,294,967,296$. That’s almost 4.3 billion, all of which have been allocated!

In the summer of 2011, the Internet Assigned Numbers Authority (IANA) allocated the last IPv4 address space. Does that mean we can’t connect other devices to the internet anymore? Not at all. Since then, the internet has grown a lot. Here’s a graph that predicts the growth of the Internet in terms of connected devices:

Note: There is a difference between an IP being allocated and being used. There might be some IPs that are allocated but not used. Such IPs are wasted.

IANA has provided all of its available IP addresses to internet service providers (ISP) around the world. However, not all of these IP addresses are being used.

In 2016, it was estimated that the total number of devices connected to the Internet is around 20 billion, which far exceeds the total number of possible IPv4 addresses.

Due to this situation, measures have been taken to slow IPv4 addressing allocation by using techniques such as network address translation (NAT) and the introduction of public and private IPs. We’ll also look at IPv6 as a solution to the aforementioned problem.

## IPv4 classes

Each of the 4 IP address fields can have any value between 0 and 255.

Note: There are 8 bits per field, so we can have $2^8 = 256$ values.

IP addresses are divided into several classes:

 IP Class Start IP End IP Network Prefix A 1.0.0.0 127.255.255.255 1 - 127 B 128.0.0.0 191.255.255.255 128 - 191 C 192.0.0.0 223.255.255.255 192 - 223 D 224.0.0.0 239.255.255.255 224 - 239 E 240.0.0.0 255.255.255.255 240 - 255
• Classes A, B, and C are used on the Internet.
• Class D is reserved for Multicast addresses.
• Class E isn’t used currently.

## Public IP vs Private IP

IPv4 addresses are of two types: public and private. Let’s discuss them.

### Public IP

Public IP addresses, as their name suggests, are used to communicate (transit) over the public internet. Private IP addresses are used in local area networks (LANs), such as our home’s network or our school’s network.

### Private IP

Private IP addresses can’t actually reach the Internet. For private IPs to be able to communicate over the Internet, a protocol such as NAT (Network Address Translation) was created to transform them into public IPs.

Listed in the table below are private IP address ranges:

 IP Class Start IP IP End Network Prefix A 10.0.0.1 10.255.255.255 10.0.0.0/8 B 172.16.0.1 172.31.255.255 172.16.0.0/12 C 192.168.0.1 192.168.255.255 192.168.0.0/16

NOTE: The IP addresses not mentioned in the table above are public

We can have multiple LANs that have private IP addresses (networks A and S) and still use public IP addresses for the rest of the networks.

These private IP addresses improve our network’s security, making it harder for potential attackers to enter it (with the help of NAT).