IPv4 Packet Header: Format and Structure

4 min read
2 August 2022
Agnė Srėbaliūtė

When you think about it, the IPv4 packet format is truly fascinating. Learn about the elements at play with this comprehensive guide.

IPv4 packet header

At any given moment, computing devices within a worldwide network called the internet send countless messages to one another. Those messages are split into multiple Internet Protocol (IP) packets – the smallest units of data. The Internet Protocol version 4 packet header – simply put, the IPv4 packet header – is fundamentally important in the delivery process as it contains the source address and destination address. Without the latter, the digital message would stay immobile.

Let’s gain a deeper understanding of the topic, starting from the very basis – the IP address.

IPv4 address – a unique identifier that connects the world

Every device connected to the internet needs an identifier – a locally or globally unique address – to communicate with one another. The Internet Protocol is responsible for identifying devices connected to the web. The main functions of the IP are routing and addressing as it forwards packets from and to computing devices on the network.

Even though the first version of the IP was created around the 1970s, the Internet Protocol version 4 (IPv4), introduced in 1981, was the one that became publicly used. 

IPv4 is a 32-bit long address expressed individually in decimal and separated by dots in four octets. It is the most commonly used IP version in the world, with a fully developed and optimized infrastructure. In total, there are 4.29 billion available combinations of IPv4, and this number was officially depleted in 2011, which led to the IPv4 address pool exhaustion.

Due to the shortage of IPv4 resources, Internet Protocol version 6 (IPv6) was introduced as a replacement. IPv6 uses 128 bits for the IP address and offers nearly infinite alphanumeric combinations to identify them. However, ever since its introduction, IPv6 adoption has been slow. Therefore, these two IP versions coexist, with IPv4 remaining the dominant one for identifying devices, often requiring complex subnet masks to manage address allocations.

Two bubbles representing the size of IPv4 and IPv6 addresses - 32 bits and 128 bits.
IPv4 addresses are 32 bits and IPv6 are 128 bits long

The role of the IPv4 packet header

When computers transmit information from one device to another, they split the messages into basic communication units, called packets or datagrams. Then, routers forward these packets along the IP network until they reach the destination where they are reassembled again.

Every IPv4 packet has the maximum value of 65,535 bytes and consists of a header and data. The IP header length can vary: From the minimum length of 20 to a total length of 60 bytes. It includes the source address and destination address, as well as other fields that help route the packet. The data is the actual message (information) of variable length.

In other words, the IPv4 header is like a written form of an address on an envelope, whereas the essential data is the letter, placed inside. Let us look at what should be written on this letter so that it would efficiently reach the recipient.

IPv4 packet header format

An IP packet envelopes the data unit received from the network layer and adds it to its header. All the information the header contains helps the datagram to reach its destination. 

The IPv4 packet header contains a fixed mandatory part, which is made of 13 fields. Let’s take a closer look at the IPv4 header format, the header fields and the roles each of them has.

IPv4 packet header table with all its values.
IPv4 packet header
  • Version: The first 4-bit header field informs about the current IP version in use, which, in this case, is IPv4
  • Internet Header Length (IHL): The IHL has four bits that specify the number of 32-bit words in the header – the minimum header length is 20 data bytes and the minimum value of this field is five
  • Service Type: This field provides the queuing of the IP packets in their transmission
  • Total Length: This is the total size of the header and data in bytes, where the minimum size of the Total Lenght field is 20 bytes and the maximum size is 65,535 bytes
  • Identification: If the IP datagram is fragmented (broken into smaller pieces), the ID field helps identify fragments and determine to which IP packet they belong to
  • IP Flags: This is a 3-bit field that uses a few possible configuration combinations of control flags for fragmentation:
    • Bit 0 is reserved and always set to 0
    • Bit 1 represents the Don’t Fragment (DF) flag, which indicates that this packet should not be fragmented
    • Bit 2 represents the More Fragments (MF) flag, which is set on all fragmented packets except the last one
  • Fragmentation Offset (Fragment Offset): The Fragment Offset field takes up 13 bits, and it performs packet tracing by representing the data bytes ahead; i.e., it determines where in the original packet the particular fragment belongs
  • Time to Live (TTL): TTL limits the datagram’s lifetime to prevent packets from an endless loop in the internet system by causing undeliverable datagrams to be discarded automatically
  • Protocol: This 8-bit field defines which protocol is used in the data portion of the packet
  • Header Checksum: If there are any communication errors in the header, the Header Checksum field detects them
  • Source IP Address: The 32-bit IPv4 address of the sender of the packet
  • Destination IP Address: The 32-bit IPv4 address of the receiver of the packet
  • Options: This optional feature is used when the value in the Internet Header Length is greater than five, hence the header length field increases (it may contain Time Stamp, Record Route or another optional field)

There’s a limit to how large a message can be, as well as the amount of data transmitted at once. Until the first IP packet is received, computers cannot send another message. The Explicit Congestion Notification (ECN) IP extension informs if there’s congestion seen in the route.

If a packet exceeds the size of 1,500 bytes, it is divided. IP fragmentation is the process of taking a single IP datagram and splitting it up into several smaller pieces (fragments). The fragmented packet of up to 567 bytes is reassembled by the receiving host, whereas the larger ones are silently discarded. The division is made by the TCP/IP network.

Conclusion

Data transmission in the computing network is a crucial element that enables the exchange of information. IPv4 is the most widely used version of the Internet Protocol on the internet, and it is responsible for the rules of data transmission between the computing machines.

Each IPv4 address includes an IPv4 header, which has a central role in IP addressing. A detailed description of the IP header fields above reveals how the header is constructed and what lies underneath every tiny bit (and byte) so that digital messages can reach the destination host quickly and efficiently.

About the author

Agnė Srėbaliūtė

Technical Content Writer

Agnė is a Technical Content Writer at IPXO. For more than 15 years she has been molding her skills in various fields, including PR copywriting, SEO copywriting and creative copywriting. Her lifestyle is based on continuous learning through numerous areas of interest, leisure activities and travelling. Addictions? Hiking and coffee.
Table of contents

Related reading

One laptop tethered to one IP address, and three laptops tethered to another.
13 October 2022   •   Internet Protocol, IPv4 for Business

Dedicated IP vs. Shared IP Addresses for Email Marketing

What are the roles of dedicated and shared IPs in email marketing? Which option offers more benefits for businesses? We have the answers for you.

Read more
An open laptop with envelopes around it representing emails.
15 September 2022   •   Internet Protocol, IP Reputation

IP Warming for Email Campaigns: What Is It and Why Is It Important?

What is IP address warming? How does it work? What kinds of challenges can you face when warming IPs? How can you benefit from this practice? We've got all…

Read more
IPv5 as a missing puzzle piece.
21 July 2022   •   Internet Evolution, Internet Protocol

First Came IPv4, Then IPv6. What Happened to IPv5? 

IPv4 and IPv6 are the only two versions of the Internet Protocol in use. Discover what happened to IPv5 and whether or not the current versions of the Internet…

Read more

Subscribe to the IPXO email and don’t miss any news!