menuGamaTrain
search

chevron_left IPv4: Internet Protocol version 4, using 32-bit addresses chevron_right

IPv4: Internet Protocol version 4, using 32-bit addresses
Anna Kowalski
share
visibility6
calendar_month2026-02-06

IPv4: The Internet's First Language

Understanding the protocol that connects billions of devices with 32-bit addresses.
IPv4, or Internet Protocol version 4, is the fundamental set of rules that allows computers and other devices to communicate on the Internet. At its heart are the unique 32-bit addresses that act like digital home addresses for every device. This article explores how these addresses are structured, the problem of their exhaustion, the clever technology called NAT that prolonged their life, and why the world is gradually transitioning to a new system called IPv6. We will break down complex ideas into simple, relatable examples suitable for all learning levels.

The Anatomy of an IPv4 Address

Think of an IPv4 address as a unique phone number for a device on a network. Just as a phone number has an area code and a subscriber number, an IPv4 address is made up of two main parts: the network portion and the host portion. The network portion identifies the specific local network (like your school or home Wi-Fi), while the host portion identifies the individual device (like your laptop or phone) on that network.

An IPv4 address is written in a format called "dotted-decimal notation." It consists of four numbers, each between 0 and 255, separated by dots. For example: 192.168.1.10. Each of these four numbers is called an "octet" because it represents 8 bits of the full 32-bit address. Since each bit can be a 0 or a 1, one octet can have $2^8 = 256$ possible values (from 0 to 255).

The total number of possible IPv4 addresses is therefore $2^{32}$, which equals:

$2^{32} = 4,294,967,296$ 

That's just over 4.2 billion unique addresses. In the early days of the internet, this seemed like an enormous number, but as we'll see, it wasn't nearly enough.

Classes, Subnets, and the Mask

To organize addresses efficiently, IPv4 was originally divided into "classes." The class of an address determines how many bits are used for the network portion and how many for the host portion. This is defined by a subnet mask.

A subnet mask looks just like an IP address (four numbers separated by dots). It uses a series of binary 1s to "mask" the network part of the address and 0s for the host part. A common subnet mask for a home network is 255.255.255.0. In binary, this is 11111111.11111111.11111111.00000000. This tells us that the first three numbers (24 bits) are the network address, and the last number (8 bits) is for hosts on that network.

Let's see how this works with a practical example. Your home router might have the IP address 192.168.1.1 and use the subnet mask 255.255.255.0. This creates a network identified as 192.168.1.0. The host portion (the last octet) can range from 1 to 254 (0 and 255 are reserved), allowing for 254 devices like phones, laptops, and smart TVs on your home network.

ClassFirst Octet RangePurposeExample AddressDefault Subnet Mask
A1 - 126Very large networks (e.g., major corporations)10.50.100.5255.0.0.0
B128 - 191Medium-sized networks (e.g., universities)172.16.0.1255.255.0.0
C192 - 223Small networks (e.g., home or small business)192.168.1.100255.255.255.0
D224 - 239Multicasting (sending to a group)224.0.0.1N/A
E240 - 255Reserved for experimental use-N/A

The class system was rigid and wasted many addresses. Today, a more flexible system called Classless Inter-Domain Routing (CIDR)[1] is used. CIDR allows for subnet masks of any length (not just 8, 16, or 24 bits), written with a slash notation. For example, 192.168.1.0/24 means the network portion is 24 bits long, the same as the subnet mask 255.255.255.0. A network like 203.0.113.0/25 would have a 25-bit network mask, allowing for fewer hosts but creating more efficient, smaller networks.

The Great Address Shortage and Clever Solutions

With only about 4.3 billion addresses, IPv4 faced a major problem: exhaustion. The explosive growth of the Internet, smartphones, tablets, and the Internet of Things (IoT) meant we were running out of unique numbers. The last large blocks of IPv4 addresses were officially distributed in 2011.

Instead of instantly switching to a new system (which became IPv6), engineers developed brilliant tricks to stretch the existing IPv4 addresses further. The two most important solutions are private addresses and Network Address Translation (NAT)[2].

Certain address ranges were reserved for "private" use, meaning they can be reused endlessly inside different private networks, like in your home, your friend's house, or your school. These ranges are:

  • 10.0.0.0 to 10.255.255.255 (a single Class A network)
  • 172.16.0.0 to 172.31.255.255 (16 Class B networks)
  • 192.168.0.0 to 192.168.255.255 (256 Class C networks)

But if everyone uses the same private addresses like 192.168.1.5, how does the Internet know which device is which? This is where NAT comes in. Your home router has one public IP address (assigned by your Internet Service Provider) that is unique on the Internet. All the devices inside your home have private addresses. The router acts as a translator or a post office. When your laptop (192.168.1.5) requests a website, the router sends the request out using its public address and keeps a note that this request came from your laptop. When the website's data comes back, the router knows to deliver it to 192.168.1.5. This way, an entire household of devices can share one public IPv4 address.

A Practical Walkthrough: Sending a Message

Let's follow an email from your computer to a friend's computer to see IPv4 in action.

  1. Step 1: Your Device. Your computer has a private IPv4 address, say 192.168.1.10. It wants to send an email to a server at 93.184.216.34 (a public address).
  2. Step 2: The Router (NAT). Your computer sends the email to your router. The router, with its public IP 85.203.19.211, replaces the source address (192.168.1.10) with its own public address (85.203.19.211). It also assigns a unique port number[3] to track this specific connection.
  3. Step 3: Across the Internet. The email packet now travels across the Internet. Routers all over the world look at the destination address (93.184.216.34) and forward it hop by hop until it reaches the correct server.
  4. Step 4: The Reply. The email server sends a reply back to 85.203.19.211 (your router).
  5. Step 5: Back to You. Your router checks its connection table, sees the reply belongs to the connection it tracked with the specific port number, and forwards the data back to your computer at 192.168.1.10.

This entire process, involving addresses, routing, and translation, happens in milliseconds and is the invisible magic of IPv4 that powers our daily Internet use.

IPv4 vs. IPv6: The Inevitable Transition

While NAT and other techniques bought us time, the future belongs to IPv6 (Internet Protocol version 6). The most critical difference is the address size: IPv6 uses 128-bit addresses instead of 32-bit. This creates a mind-bogglingly large number of possible addresses:

$2^{128} \approx 340,282,366,920,938,463,463,374,607,431,768,211,456$ 

That's about 340 undecillion addresses. To put it in perspective, this is more than enough to give a unique address to every grain of sand on Earth, and then some. IPv6 eliminates the need for NAT in most cases, simplifying network design and improving connectivity.

An IPv6 address looks very different. It is written in hexadecimal and separated by colons, for example: 2001:0db8:85a3:0000:0000:8a2e:0370:7334. The world is currently in a long transition period where both IPv4 and IPv6 run side-by-side. Most modern devices and networks support both protocols (called dual-stack).

FeatureIPv4IPv6
Address Length32 bits128 bits
Address FormatDotted-decimal (e.g., 192.168.1.1)Hexadecimal with colons (e.g., 2001:db8::1)
Approximate Number of Addresses4.3 billion340 undecillion
Need for NATEssential due to address shortageLargely unnecessary
Auto-configurationUsually requires DHCP[4]Built-in (Stateless Address Autoconfiguration)

Important Questions

Q1: If my device has a private IP address (like 192.168.1.5), how can I find out my public IPv4 address?

You can easily find your public IP address by asking a website that can see it. Since your router uses this address to communicate with the Internet, websites like "whatismyip.com" or simply searching "what is my IP" on Google will display the public IPv4 address assigned to your router by your Internet Service Provider. This is the address that the rest of the Internet sees.

Q2: Why can't we just add more bits to IPv4 to create more addresses?

The design of IPv4 is fixed in hardware and software worldwide. Changing the fundamental 32-bit length would require updating every single router, server, network card, and operating system on the planet at the same time—an impossible task. It's much more practical to create a new protocol (IPv6) that can coexist with the old one during a gradual transition. Devices can support both IPv4 and IPv6 simultaneously until IPv4 is eventually phased out.

Q3: Are all IPv4 addresses used up? Can I still get one?

While the central pool of new IPv4 addresses is exhausted, addresses are still bought, sold, and leased on a secondary market. Your Internet Service Provider (ISP) has a block of addresses that it dynamically assigns to customers. When you connect, you get one from their pool, and when you disconnect, it goes back. For most home users, this dynamic assignment combined with NAT means you don't need a dedicated public IPv4 address. Large companies needing many permanent addresses may have to purchase them from other organizations.

Conclusion

IPv4, with its 32-bit addressing scheme, is the workhorse protocol that built the modern Internet. Understanding its dotted-decimal notation, the role of subnet masks, and the critical concepts of private addressing and NAT provides a foundational view of how global networking functions. The ingenious solutions developed to cope with its limited address space are a testament to engineering creativity. While the future is undoubtedly IPv6, IPv4 remains deeply embedded in our digital infrastructure. Grasping its principles is key to understanding the past, present, and future evolution of the Internet.

Footnote

  1. CIDR (Classless Inter-Domain Routing): A method for allocating IP addresses and routing Internet Protocol packets that replaces the older classful network system. It allows for more flexible and efficient use of addresses.
  2. NAT (Network Address Translation): A technique used in routers to map multiple private IP addresses inside a local network to a single public IP address before transmitting data onto the Internet.
  3. Port Number: A 16-bit number used in conjunction with an IP address to identify a specific process or service on a device (e.g., web traffic typically uses port 80).
  4. DHCP (Dynamic Host Configuration Protocol): A network management protocol used to automatically assign IP addresses and other communication parameters to devices on a network.

Did you like this article?

home
grid_view
add
explore
account_circle