IPv4 (Internet Protocol version 4) is the network-layer protocol that identifies interfaces with 32-bit addresses and forwards packets between networks on a best-effort, connectionless basis. In Internet addressing, it is the scheme behind familiar dotted-decimal addresses such as 192.0.2.1, and despite the growth of IPv6 it still carries a large share of global traffic.
The 32-bit design yields about 4.29 billion addresses (2 to the power of 32), a number that seemed vast when the protocol was standardized in 1981 and proved too small once the Internet became public. The regional free pools are now exhausted, so IPv4 survives through address sharing, NAT and a secondary market for address blocks.
How IPv4 addresses are structured
An IPv4 address is a 32-bit number written as four decimal octets from 0 to 255, separated by dots. Each address is divided into a network prefix, which routers use to forward traffic, and a host part, which identifies an interface within that network.
The boundary is expressed with CIDR notation, where /24 means that the first 24 bits form the prefix. The original classful system of Class A, B and C networks was replaced by CIDR in 1993 because fixed sizes wasted addresses and inflated routing tables.
The table below shows how common prefix lengths translate into network sizes.
| Prefix length | Subnet mask | Total addresses | Typical use |
|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,216 | Very large legacy allocations |
| /16 | 255.255.0.0 | 65,536 | Campus or cloud virtual networks |
| /24 | 255.255.255.0 | 256 | Office LAN, smallest globally routed block |
| /30 | 255.255.255.252 | 4 | Legacy point-to-point links |
| /32 | 255.255.255.255 | 1 | A single host route |
In a conventional subnet, the first address is the network address and the last is the broadcast address, so a /24 provides 254 usable host addresses. Point-to-point links may use /31 prefixes, which have no broadcast address.
Inside the IPv4 header
Every IPv4 packet starts with a header of 20 to 60 bytes that tells routers where the packet goes and how to treat it. The fields below matter most in operations and troubleshooting.
| Field | Size | Function |
|---|---|---|
| Version and IHL | 4 bits each | Protocol version 4 and header length |
| DSCP and ECN | 6 and 2 bits | Quality-of-service marking and congestion signals |
| Total length | 16 bits | Packet size, up to 65,535 bytes |
| Identification, flags, fragment offset | 32 bits combined | Fragmentation, reassembly and the DF (do not fragment) bit |
| Time to live (TTL) | 8 bits | Hop limit that prevents endless loops |
| Protocol | 8 bits | Payload type, for example 6 for TCP or 17 for UDP |
| Header checksum | 16 bits | Detects header corruption, recalculated at each hop |
| Source and destination address | 32 bits each | Sender and receiver interfaces |
When a packet exceeds the maximum transmission unit (MTU) of a link, a router may fragment it unless the DF bit is set. Modern hosts prefer Path MTU Discovery instead, but firewalls that block the necessary ICMP messages cause the well-known PMTUD black hole, in which small requests succeed and large transfers hang.
Special-purpose IPv4 address ranges
Several IPv4 ranges are reserved for special purposes and are never routed on the public Internet. Recognizing them is essential for firewall rules, troubleshooting and documentation.
| Range | Name | Purpose |
|---|---|---|
| 10.0.0.0/8 | Private network | Internal networks behind NAT |
| 172.16.0.0/12 | Private network | Internal networks behind NAT |
| 192.168.0.0/16 | Private network | Home and small office networks |
| 100.64.0.0/10 | Shared address space | Carrier-grade NAT inside provider networks |
| 127.0.0.0/8 | Loopback | Traffic to the local host itself |
| 169.254.0.0/16 | Link-local | Automatic addressing when DHCP fails |
| 224.0.0.0/4 | Multicast | One-to-many group delivery |
| 192.0.2.0/24 | Documentation | Examples in manuals, never in production |
An address from 169.254.0.0/16 on a workstation is a reliable sign that DHCP failed, while an address from 100.64.0.0/10 on a home router shows that the provider uses carrier-grade NAT and the subscriber has no public IPv4 address of its own.
IPv4 compared with IPv6
IPv6 was designed as the long-term successor to IPv4, but the two protocols are not directly compatible, so networks run them side by side in dual-stack configurations or translate between them.
| Property | IPv4 | IPv6 |
|---|---|---|
| Address length | 32 bits | 128 bits |
| Notation | Dotted decimal, 192.0.2.1 | Hexadecimal groups, 2001:db8::1 |
| Header | Variable, 20-60 bytes, with checksum | Fixed 40 bytes, no checksum |
| Fragmentation | Routers and hosts | Source hosts only |
| Address configuration | Manual or DHCP | SLAAC, DHCPv6 or manual |
| Address scarcity | Exhausted, NAT widespread | Abundant, end-to-end addressing possible |
Living with IPv4 address exhaustion
Since the regional registries ran out of freely available space in the 2010s, organizations obtain IPv4 addresses through waiting lists, transfers or leasing, and prices on the transfer market have reached tens of US dollars per address, depending on block size and timing.
- NAT and port address translation let many private hosts share one public address, at the cost of end-to-end reachability.
- Carrier-grade NAT adds a second translation layer at the provider, which complicates logging, gaming and peer-to-peer applications.
- Cloud providers charge for public IPv4 addresses, which pushes architectures toward load balancers and IPv6.
- Address reputation matters: a purchased block may carry blocklist entries from a previous holder.
A common misconception is that NAT is a security feature. It hides internal addressing, but filtering comes from the stateful firewall that usually accompanies it, not from translation itself.
The idea in brief
IPv4 is the original numbering system for devices on the Internet. Every device that talks online needs an address, and IPv4 writes it as four numbers between 0 and 255, such as 192.0.2.1.
The system has room for about four billion addresses, which is fewer than the number of connected devices today. That is why homes and companies share one public address among many devices, and why the newer IPv6 system exists alongside it.
A practical scenario
A company with 180 employees in one office receives a single public IPv4 address from its provider. The network team assigns the internal network 10.20.0.0/22, which provides 1,022 usable host addresses, and splits it into separate /24 subnets for staff computers, phones, printers and guests.
The firewall translates all outbound traffic to the one public address with port address translation, and it forwards incoming connections only for the company’s VPN gateway. When a printer suddenly shows the address 169.254.12.7, the team immediately suspects DHCP and finds a misconfigured switch port. The design serves the whole office with one public address, while a parallel IPv6 rollout prepares the network for growth without buying additional IPv4 space.