DEV Community

Cover image for IPs Explained: The Address of the Internet
habdulr1
habdulr1

Posted on

IPs Explained: The Address of the Internet

Understanding IP Addresses: A Simple Guide for Everyone

In the digital age, where we rely heavily on the internet for communication, work, and entertainment, an IP address is often overlooked yet fundamental. An IP address, or Internet Protocol address, is a unique identifier assigned to each device connected to the internet, enabling them to communicate with one another.

An IP address (Internet Protocol address) is like the address for your house—but for your device on a network or the internet. It’s a unique set of numbers that identifies your device (be it your laptop, PC, mobile, smart TV or any other device) so it can send and receive data, just like a postal address tells mail where to go.

Think of it like this:

Your home address tells the post office where to deliver packages.
An IP address tells the internet where to deliver websites, videos, or emails to your device (packets of data).

What Does an IP Address Look Like?

An IP address is usually written as a series of numbers separated by dots. For example:

192.168.1.1 (a common private IP)
8.8.8.8 (a public IP used by Google)

IPv4 versus IPv6 Addresses
There are two primary types of IP addresses: IPv4 and IPv6. IPv4 addresses consist of four sets of numbers, ranging from 0 to 255, separated by periods like seen above. An example is 113.178.10.11. Due to the growing number of devices accessing the internet, IPv6 was introduced, featuring a more complex structure that allows for a much larger pool of addresses. This format is expressed in eight groups of hexadecimal numbers, such as 2001:0db8:85a3:0000:0000:8a2e:0370:7334.

In the early days of the Internet, the number of connected devices was relatively small. Engineers designed the IPv4 protocol to accommodate this modest scale. They devised a system called Class-Based IP Addressing, dividing the IP space into five classes. Class A, B, C, D & E. based on the number of devices each network needed to support. These classes are primarily defined by the leading bits and determine the size of the network and host portions of the address. Here's a breakdown of the classes:

Here’s a quick analogy to understand these classes:

Class A: The mansions of IP addresses, with room for millions of devices in a single network. Ideal for large organizations.

Class B: The mid-sized apartments, capable of hosting thousands of devices.

Class C: The cozy cottages, perfect for small networks with fewer devices.

Class D & E: Reserved for experimental and multicast uses.

What are Leading Bits?
Leading bits are the first few bits in the binary representation of an IPv4 address. These bits are used to classify the address into one of the five address classes (A, B, C, D, or E). They define the structure of the IP address, particularly how the network portion and the host portion are divided.

How Leading Bits Determine Network and Host Portions?
IPv4 addresses are 32 bits long. The address is divided into two parts:
Network Portion: Identifies the network (shared by all devices in that network).
Host Portion: Identifies the specific device (host) within the network.
The number of leading bits used for the network portion determines how many bits are left for the host portion. The fewer bits used for the network portion, the more bits are available for hosts, and vice versa.

Class Leading Bits Network Bits Host Bits Max Hosts per Network
A 0 8 bits 24 bits ~16 million (2³¹ - 2 usable)
B 10 16 bits 16 bits ~65,536 (2¹⁶ - 2 usable)
C 110 24 bits 8 bits ~254 (2⁸ - 2 usable)
D 1110 Multicast N/A Used for multicasting, not hosts
E 1111 Experimental N/A Reserved for experimental use

Practical Example
Let’s take the IPv4 address 192.168.1.1:

Binary form: 11000000.10101000.00000001.00000001.
Leading bits: 110 (Class C).
Network portion: First 24 bits (192.168.1).
Host portion: Last 8 bits (1).
This means 192.168.1.1 belongs to a Class C network, where the network part is 192.168.1, and the device within this network is 1.

In summary, IP addresses play a crucial role in ensuring that our devices can communicate effectively online. By grasping the basics of what an IP address is and how it operates, we can gain a clearer understanding of the interconnected world we navigate daily. I will cover about classless IP addresses using CIDR range in the next post.

Top comments (1)

Collapse
 
math_unveiled_aa8646b3217 profile image
Math Unveiled

great insight, sir, Thanks for sharing