IPv4

On this page 7

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 lengthSubnet maskTotal addressesTypical use
/8255.0.0.016,777,216Very large legacy allocations
/16255.255.0.065,536Campus or cloud virtual networks
/24255.255.255.0256Office LAN, smallest globally routed block
/30255.255.255.2524Legacy point-to-point links
/32255.255.255.2551A single host route
Common IPv4 prefix lengths

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.

FieldSizeFunction
Version and IHL4 bits eachProtocol version 4 and header length
DSCP and ECN6 and 2 bitsQuality-of-service marking and congestion signals
Total length16 bitsPacket size, up to 65,535 bytes
Identification, flags, fragment offset32 bits combinedFragmentation, reassembly and the DF (do not fragment) bit
Time to live (TTL)8 bitsHop limit that prevents endless loops
Protocol8 bitsPayload type, for example 6 for TCP or 17 for UDP
Header checksum16 bitsDetects header corruption, recalculated at each hop
Source and destination address32 bits eachSender and receiver interfaces
Key IPv4 header fields

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.

RangeNamePurpose
10.0.0.0/8Private networkInternal networks behind NAT
172.16.0.0/12Private networkInternal networks behind NAT
192.168.0.0/16Private networkHome and small office networks
100.64.0.0/10Shared address spaceCarrier-grade NAT inside provider networks
127.0.0.0/8LoopbackTraffic to the local host itself
169.254.0.0/16Link-localAutomatic addressing when DHCP fails
224.0.0.0/4MulticastOne-to-many group delivery
192.0.2.0/24DocumentationExamples in manuals, never in production
Reserved IPv4 ranges

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.

PropertyIPv4IPv6
Address length32 bits128 bits
NotationDotted decimal, 192.0.2.1Hexadecimal groups, 2001:db8::1
HeaderVariable, 20-60 bytes, with checksumFixed 40 bytes, no checksum
FragmentationRouters and hostsSource hosts only
Address configurationManual or DHCPSLAAC, DHCPv6 or manual
Address scarcityExhausted, NAT widespreadAbundant, end-to-end addressing possible
IPv4 and IPv6 at a glance

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.