Illustration
  • Element
IPv4 & IPv6 | What is...?

What is an IP Header? Structure and Contents

If you think about it, the Internet never sleeps. It is a home for billions of devices that form 24/7 connections across the world. And in this fascinating process, the IP header is the main character.

Without it, devices wouldn’t be able to communicate with each other, simply because the information wouldn’t know where to go. To make sure messages are sent to the right destination, they are split into multiple IP packets. 

These packets have certain headers attached to them. IP headers contain the source and the destination addresses. These ensure data travels correctly and efficiently across the Internet, hence the importance of an IP header.

This begs the question, ”what is an IP header?”, and that’s what we are going to answer today. So, keep reading if you are interested in learning about the structure and format of an IP header and its role in online communications.

Network routing is the process of choosing the fastest and most efficient way the data can take to reach its destination. When a device sends information across the network, the router will read the source and destination IP addresses attached to it. Then, it will choose the best route for the information to travel on.

But the source and destination IPs are just a piece of the puzzle. When a device sends information to another device, the message is broken down into basic communication units. They are called packets, or datagrams. Routers forward these packets along the IP network until they reach their destination, where they will be reassembled.

For this article, we will mainly refer to IPv4 packets and headers, as the fourth version of the Internet Protocol is still the most used. Each IPv4 packet sent across the Internet is made of data and a header. The IP header length varies from 20 bytes to a maximum of 60 bytes. This header includes destination and source addresses, but also other fields that help send the packet where it needs to land.

You can simply think of the essential data/message placed in an envelope, while the IP header is what’s written on the envelope. It’s the sender’s address and the receiver’s address, among other details. Let’s have a look at what’s written on this imaginary envelope, shall we?

The format of an IPv4 header

An IP packet takes the data unit received from the network layer and adds it to its layer. Everything that’s written in the IP header helps the packet, or the datagram, reach its destination.

Let’s take a look at an IPv4 format and discuss its field and what each one means. Here is a simple representation of an IP header:

At first, it might look a bit confusing. No need to worry. Let’s take them piece by piece and see what they are about.

  • Version – The first field of the header indicates the IP version in use. In this case, we are talking about IPv4. It is a 4-bit field
  • IHL –  Short for Internet Header Length. This shows the length of the IP header in a  32-bit format. This is also a 4-bit field. The minimum length here is 20 bytes and the maximum is 26. So, the header length field should contain a value of either 5 or 6. 
  • TOS –  Short for Type of Service. This field provides the queuing of the IP packets in their transmission. In other words, this field lines up the IP packets in the correct order.
  • Total Length – It shows the length of the IP packet that includes both the IP header and the user data. Here, the minimum size of the field is 20 bytes and the maximum size is 65,535 bytes.
  • Identification – If the IP datagram is split into smaller pieces, the ID field helps identify fragments and determine to which IP packet they belong.
  • Flags – This is a 3-bit field that uses a few configurations in case fragmentation is needed. Let’s see what they do:

Bit 0 is reserved and always set to 0;

Bit 1 tells that this packet should not be fragmented. This is a flag titled DF (Don’t Fragment);

Bit 2 represents the MF (More Fragments) flag. This is set on all fragmented packets except the last one.

  • Fragment/Fragmentation Offset – It determines the placement of a particular fragment in the original IP packet.
  • TTL (Time To Live)  – TTL basically limits the datagram’s lifetime. This is done to maintain the stability of the Internet system by auto-deleting undeliverable packets.
  • Protocol – This field defines which protocol is used in the data part of the packet.
  • Header Checksum – This field detects any communication errors in the IP header.

And last, but not least:

  • The Source Address – The IPv4 of the sender of the packet;
  • The Destination Address – The IPv4 of the receiver of the packet;
  • Options: This is an optional feature. It is used when the value in the Internet Header Length is greater than five, hence the header length field increases (it may contain Timestamp, Record Route, or another optional field).

What is IP fragmentation?

There’s a limit to how large a message can be. If a packet exceeds the size of 1,500 bytes, it is divided. This process is called IP fragmentation. It basically breaks down an IP datagram into smaller pieces called fragments. Then, the receiving host will reassemble the packet and get the information.

You should know that there’s also a limit to how many IP packets can be sent at once. Until the first IP packet gets to its destination, devices cannot send another message. 

Conclusion

By now, you should have a basic understanding of the structure and content of an IP header. It has important details that are instrumental in network routing. At the end of the day, you cannot send a letter in an envelope that doesn’t have important notes written on it, right?

Successful exchange of information depends on IP headers. As we saw earlier, each component of the IP header is designed to help information get to its destination as quickly and efficiently as possible. 


By Carol Zafiriadi

According to the ancient texts, Carol has been passionate about IT and technology since his youth. He brought his experience and creativity to Pubconcierge as content writer, ready to both assimilate and share valuable information.

Related Articles

Request Free Testing

Accelerate your business and improve ROI with IP leasing

  • 1

    Leave your contact information

  • 2

    Receive a customized solution

  • 3

    Test it for free

Want to learn more about us?

Read More
Contact Us

Contact our sales team

  • 1

    Leave your contact information

  • 2

    Recieve a personal offer

  • 3

    Get the best solution for your case

Want to learn more about us?

Read More