When diving into networking, the term IPv4 comes up pretty quickly, and for good reason. It’s one of the key building blocks of the internet today, despite being on the brink of being replaced by its successor, IPv6. Let's break it down.
What is IPv4?
IPv4 stands for Internet Protocol version 4, which is used for identifying devices on a network. Think of it as a street address for your device, allowing data to be sent to the correct location on the vast internet highway.
Unlike a MAC address, which is burned into the device’s hardware by the manufacturer, an IPv4 address is dynamically assigned by a DHCP server (Dynamic Host Configuration Protocol) or can be manually set by the network admin.
An IPv4 address is a 32-bit address, meaning it’s made up of four 8-bit octets, usually represented as four decimal numbers separated by periods (e.g., 192.168.0.1). This format gives around 4.3 billion possible addresses, which, as you might have heard, isn’t enough anymore. Enter IPv6, a new protocol with a much larger address space.
While IPv4 is slowly being phased out in favor of IPv6, it remains the backbone of global internet traffic.
Public vs. Private IPs
In the world of IPv4, there are two major types of IP addresses: public and private.
Private IP addresses are used within a local network (LAN) and are not routable over the internet. They are reserved for internal network use and help maintain security by ensuring devices within your network cannot be directly accessed from outside. Common private IP ranges include 192.168.x.x, 10.x.x.x, and 172.16.x.x to 172.31.x.x.
Public IP addresses, on the other hand, are used to identify devices that are directly accessible from the internet. When a device on a private network needs to access the internet, NAT (Network Address Translation) comes into play. NAT translates the private IP address into a public IP address, allowing the device to communicate with external services.
For example, when you type ping google.com in the terminal, your device’s private IP address is translated to a public IP via your router’s NAT function, and the request reaches the outside world.
The Basics of IPv4 Routing
IPv4 is a connectionless protocol, meaning each packet of data is sent independently and may take different paths to its destination. It’s also important to note that IPv4 only provides best-effort delivery; it doesn’t guarantee data delivery. The job of ensuring reliability falls to higher-layer protocols like TCP (Transmission Control Protocol).
So how do packets get from your device to the right destination? That’s where routing comes in. Routers are responsible for directing data packets between devices on different networks. They use routing protocols to decide the best path based on several factors, such as hop count, network load, and bandwidth.
An important aspect of routing is that it relies on a hierarchical structure for addressing. IPv4 addresses are divided into two main parts:
- Network Portion: This part identifies the specific network the device belongs to. It helps routers know which path to take to reach the destination network.
- Host Portion: This part identifies the specific device within the network. Once the packet reaches the correct network, it will be forwarded to the correct device based on this portion of the address.
How Does IPv4 Work?
Let’s look at a real-world example. Imagine you’re trying to contact a device within a local network with the IP address 10.1.1.2.
- The router will first check the network portion of the destination address (i.e., the first three octets: 10.1.1).
- It will then forward the packet to the appropriate network.
- Once the packet reaches the network, routers will use the host portion (i.e., the last octet: .2) to identify the specific device and deliver the data.
If you're communicating over the internet, the process is similar but involves more hops, as routers examine the network portion to determine the best path to the destination network and then the host portion to deliver the packet to the right device.
IPv4 Address Format
An IPv4 address is written as four decimal numbers separated by periods, like 10.1.1.1. Each number represents one byte (or 8 bits) and can range from 0 to 255. So, a 32-bit IPv4 address consists of four 8-bit segments:
- 10: 8 bits
- 1: 8 bits
- 1: 8 bits
- 1: 8 bits
This allows for over 4 billion unique addresses, but as you can imagine, that’s no longer enough. The exponential growth of devices and internet usage has led to IPv4 address exhaustion, which is why IPv6 was introduced to handle the need for a virtually unlimited number of addresses.
Summary
IPv4 might be on the way out, but it's still a core component of how the internet operates today. From dynamically assigning addresses via DHCP to translating private IPs into public ones for internet access, IPv4 plays a crucial role in networking. It’s the backbone of routing, address allocation, and data delivery across the globe.



Top comments (0)