IPv4 Datagram Header

IPv4 Datagram Header

Have you ever wondered how messages and information travel across the internet so quickly and accurately? At the heart of this journey is the IPv4 Datagram Header. An IPv4 Datagram Header is a crucial component of the Internet Protocol version 4 (IPv4), which is used for routing Internet traffic and other packet-switched layer networks such as Ethernet. The header plays a significant role in ensuring the correct delivery of data across networks by providing essential information about the datagram (packet).

Structure of the IPv4 Datagram Header

The IPv4 Datagram Header consists of a fixed mandatory part of 20 bytes, which can be extended up to 60 bytes with optional fields. The header is organized into several fields, each serving a specific purpose:

IPv4 Datagram Header

Version (4 bits)

Indicates the version of the IP protocol, which is 4 for IPv4.

Header Length (IHL) (4 bits)

Specifies the total length of the header in 32-bit words. The minimum value is 5 (indicating 20 bytes), and the maximum is 15 (indicating 60 bytes).

Type of Service (8 bits)

Used for specifying how the datagram should be handled, focusing on aspects like low delay, high throughput, and reliability.

Total Length (16 bits)

Represents the combined length of the header and data, ranging from a minimum of 20 bytes to a maximum of 65,535 bytes.

Identification (16 bits)

A unique identifier for the datagram, used in fragmenting and reassembling datagrams[1][2].

Flags (3 bits)

Controls and identifies fragments. It includes a reserved bit (must be zero), a “do not fragment” flag, and a “more fragments” flag.

Fragment Offset (13 bits)

Indicates the position of a fragment within the original datagram.

Time to Live (TTL) (8 bits)

Limits the datagram’s lifespan, reducing the value by one at each router hop until it reaches zero, at which point the datagram is discarded.

Protocol (8 bits)

Identifies the protocol to which the data in the datagram is to be passed (e.g., TCP, UDP).

Header Checksum (16 bits)

Used for error-checking the header. It is recalculated at each router hop.

Source IP Address (32 bits)

The IP address of the sender.

Destination IP Address (32 bits)

The IP address of the intended recipient.

Options (Variable Length)

Optional fields for features like security, record route, and timestamp, which can extend the header length up to 60 bytes.

Key Characteristics

Connectionless Protocol

IPv4 operates on a best-effort delivery model, meaning it does not guarantee delivery, maintain sequencing, or prevent duplicate delivery.

Addressing

Uses 32-bit addresses, allowing for a theoretical maximum of approximately 4.3 billion unique addresses, expressed in dot-decimal notation (e.g., 192.168.1.5).

Fragmentation

Supports breaking down datagrams into smaller fragments to accommodate the maximum transmission unit (MTU) of the network path, with fields like Identification, Flags, and Fragment Offset facilitating this process.


The IPv4 Datagram Header is essential for the routing and delivery of data across IP networks, providing the necessary information for addressing, fragmentation, and quality of service, among other functionalities.

Scroll to Top