IP Addresses

Photo by Jonathan on Unsplash

IP Addresses

An IP address is a unique 32-bit address that identifies any device connected to the internet. It is of the form X.X.X.X. Each networked device has a unique IP address attached to it.

The definition for the IP address above is that of the IPV4 IP address since it was the first variation of IP addresses. IP addresses, however, come in two variants, the IPV4 and the IPV6 addresses.

The reason there are different variations of the IP address is as a result of the growing number of devices that are connected to the internet. Since an IPV4 address is only a 32-bit number, it allows for a maximum of 4 billion IPV4 addresses.

$$\text{Total IPv4 addresses} = 2^{32}=4,294,967,296$$

This led to the introduction of the IPV6 address, which supports even more devices. It is estimated that there can be a total of 340 trillion trillion trillion IP addresses. IPv6 addresses are 128 bits in length and are written as eight groups of four hexadecimal digits separated by colons.
An example of an IPV6 address is this: 2001:db8:3333:4444:5555:6666:7777:8888
They do not only consist of numbers but also letters in general.

$$\text{Total IPv6 addresses} = 2^{128} \approx 3.4 \times 10^{38}$$

Types of IP Addresses

IP addresses are grouped based on the following criteria: the location of the device in a network and the static or dynamic nature of the IP address generated for the device. As a result, there are 4 types of IP addresses:

  • Static IP address

  • Dynamic IP address

  • Private IP address

  • Public IP address

PUBLIC IP ADDRESS: Public IP addresses are those that are assigned to a device in order to make it communicate over the internet. These addresses are generated by the ISP for every device, which makes it possible for the devices to be reachable over the internet. You can check your public IP address using this service.

Private IP Address: Private IP addresses are assigned to devices in a network and are not meant to be exposed to the internet. They are assigned by the router and are used to uniquely identify devices that are in the current network of the router. IP addresses that are private are only limited to the current router they are connected to, meaning that outside of the current router network, there can be the same IP address again in another router’s network. That is to say, they are only unique to their current network.

Static IP Address: A static IP address is one that is manually assigned to a device and does not change. These are the typical IP addresses used by servers over the internet. Because they are static, it is easier for clients to resolve their domain names to their IP addresses using a DNS resolver.

Dynamic IP Address: Dynamic IP addresses are those that are assigned by ISPs to devices when they connect to the network. Dynamic IP addresses are only present for some time, after which they expire and have to be reassigned. Dynamic IP addresses are created by the ISPs using the Dynamic Host Configuration Protocol (DHCP).

DHCP (Dynamic Host Configuration Protocol)

The Dynamic Host Configuration Protocol is a client-server architecture used in networking to ensure that devices get assigned IP addresses when they connect to a network. The DHCP server maintains a pool of IP addresses that are currently being used and those that are not currently being used. For each request from a DHCP enabled client that comes in, the server leases one of its unused IP addresses to it.

A DHCP client is a piece of software that runs on devices that can connect to the internet, such as mobile phones, laptop, etc. Immediately the device gets connected to the network, the client broadcasts a request for the IP address and other configuration of which the DHCP server responds to with one of the ip addresses from its pool. Clients receive IP addresses for a certain amount of time known as Lease time. Before this time is up, the client can request to renew the IP address, think of it like requesting a new access token with your refresh token in your web applications.

DHCP servers eliminate the need to manually assign IP addresses and reduce the overall risk of making a mistake when assigning IP addresses. Having DHCP servers ensures that devices do not get static IP addresses since static addresses are becoming more and more scarce with the growing number of networked devices.

More details about the DHCP protocol is defined in RFC 1531

IP addresses, in combination with port numbers, ensure that devices over the internet can send and receive information from one device to another.