IPv4 Header Format, Diagram, and its Significance
Internet Protocol version 4, or IPv4, is one of the most widely used protocols for sending or receiving data over different kinds of networks. It is a connectionless protocol and does not guarantee the delivery of data, order, or integrity of the packets. Furthermore, it is used to provide a logical connection between the network devices simply by assigning a unique identification number (IP address) to each device available on the network. In this blog, we will explain the IPv4 header format, which is the information that is used to add data before it is transmitted over the network. Apart from that, we will be discussing different components of the IPv4 header format that are essential for the routing and delivery of packets. IPv4 and IPv6 are integral part of every network engineers life. The basics of IP Addressing is covered in CCNA Course. If you want to learn more about IPv4 header, you can opt for ENCOR 350-401 Training. Before getting into more details, let’s first understand the IPv4. IPv4 stands for Internet Protocol version 4 is the addressing system which assigns unique labels to devices on the internet. You can think of IPv4 as the address label on a package you are sending in the mail. Just like the label includes information about the sender, receiver, and nature of the contents, the IPv4 Header also contains information regarding the data that is being sent over the internet. As we all know, that IPv4 packet is also known as a datagram. It mainly consists of two parts, i.e., a header and a payload. When we talk about the header, it is the meta information that is added to the data by the sender and removed by the receiver. It is a 20-byte structure and has a fixed format that is defined by the IETF in RFC 791. Furthermore, it is divided into four sections, i.e., version, IHL (Internet Header Length), TOS (type of services), and total length; and total length; identification, flags, and fragment offset; time to live (TTL), protocol, and header checksum; source address and destination address. After the header comes the optional part that can be up to 40 bytes long. Options are additional information that can be used for various purposes, such as security, routing, or timestamping. On the other hand, the payload is the actual data that is being transmitted to the receiver. Below, we have provided an IPv4 header diagram for better understanding. In this section, we will explain each component of the IPv4 header format and will also discuss how each component is used. Let’s begin! The version field is 4-bit, which indicates the version of the Internet protocol that is used in the packet. In this case, it is version 4, i.e., IPv4. IHL or Internet Header Length is also a 4-bit length that specifies the header’s length in 32-bit words. The minimum header length is 20 bytes, i.e., 5 words, and the maximum header length is 60 bytes, i.e., 15 words. Hence, this field can only have values between 5 and 15. TOS or type of service is 8-bit long, which indicates the QoS (Quality of service) that is requested for the packet. Further, it can be used to specify parameters such as priority, delay, throughput, reliability, or cost. TOS has been redefined several times; moreover, different standards use different interpretations of its bits. Let’s understand what these parameters are – Below we have shown these parameters along with their possible values in the form of the table. The total length field is 16 bits long and specifies the length of the entire packet in bytes. This includes both the header and the payload. The minimum value can vary from 20 bytes, i.e., the minimum header length, to a maximum value of 65535 bytes, i.e., the maximum size of the packet. If the packet is larger than the provided maximum size, the packet will then be fragmented into smaller pieces by the routers or hosts. The identification field is 16 bits long and is mainly used to identify packets that belong to a fragment group. When we talk about fragment groups, it consists of all the packets that are fragmented from the original packet. The main work of the identification field is to assist in reassembling the fragments at the destination. The flag field is 3 bits long and controls as well as identifies fragments. It has three possible values. These are: The position of the packet in the original datagram is indicated by fragment offset. It is measured in units of 8 bytes. Fragment offset of zero belongs to the first packet of a datagram. The following other packets have a fragment offset that is equal to the sum of the lengths of the previous packets divided by 8. The fragment offset field further assists in reassembling the fragments at the destination. TTL, or time-to-live field, is 8 bits long, and with the help of TTL, one can easily know the maximum time that a packet can live in the network. It is measured in seconds, and it keeps on being decremented by one by every device that processes the packet. When the value reaches zero, the packet is discarded, and an ICMP message is sent back to the sender. With the help of TTL, it is now possible to prevent packets from looping endlessly in the network and consuming resources. The protocol field indicates the type of protocol that is used in the payload. Furthermore, it identifies the next-level protocol that processes the data after the IP layer. Below, we have shown some common values for this field for better understanding. In order to verify the integrity of the header, header checksum field is utilized. It is calculated by adding all the 16-bit words in the header and taking one’s complement of the result. If there are any errors in the header, such as bit flips or corrupted fields, the checksum will not match, and the packet will be discarded. This field signifies the IP address of the sender of the packet. The source address field is a 32-bit number used to identify a host or a network interface on the internet. Similar to the source address field, the destination address field indicates the IP address of the receiver of the packet. It is also a 32-bit number that uniquely identifies a host or a network interface on the internet. The option field is variable in length and contains optional information that can be further used for different purposes. Some of these are security, routing, or timestamping. Each option has a format of: These are the components of IP4 header format. Let’s see the purpose of various fields of IPv4 header. IPv4 is a critical component of the Internet infrastructure that plays a vital role in routing Internet traffic all over the globe. The significance of the IPv4 header in routing is beyond its technical functions. The header has an impact on the development of the internet. The widespread adoption of IPv4 in the early 1980s and 1990s led to rapid internet growth. Apart from all this, the Header’s design has also influenced the development of subsequent internet protocols, i.e., IPv6. The IPv4 header format is a 20-byte structure that contains information such as source and destination addresses, protocol, and checksum. IPv4 format is a 32-bit number divided into four octets. A dot separates each octet and has a value from 0 to 255. IPv6 header format consists of 8 fields: version, traffic class, flow label, payload length, next header, hop limit, source address, and destination address. Each field has a fixed size and position in the header. Twelve basic header fields of IPv4 are Version, IHL, DSCP, ECN, Total Length, Identification, Flags, Fragment Offset, TTL, Protocol, Header Checksum, Source Address and Destination Address. Their main purpose is to provide information regarding packets and their routing. In this blog post, we learned about the IPv4 header format, which is the additional information attached to the data before it is transmitted over the network. We have explained different fields of the IPv4 header in detail and also explained their purpose. If you have any questions or feedback, please feel free to leave a comment below.Introduction
What is IPv4?
What is the IPv4 Packet Header?
IPv4 Header Diagram
IPv4 Header Format Components
Version
IP Version Description 0 Reserved 1-3 Unassigned 4 IP Version 4 5 Stream IP Datagram Mode (experimental protocol) 6 IP Version 6 7 TP/IX 8 The “P” internet protocol 9 TUBA 10-14 Unassigned 15 Reserved IHL
TOS
Bit 3: 0 = normal delay 1 = low delay Bit 4: 0 = normal throughput 1 = high throughput Bit 5: 0 = normal reliability 1 = high reliability Bit 6-7: Reserved for future use Precedence Delay Throughput Reliability Routine (000) Normal (0) Normal (0) Normal (0) Priority (001) Low (1) Normal (0) Normal (0) Immediate (010) Normal (0) High (1) Normal (0) Flash (011) Low (1) High (1) Normal (0) Flash Override (100) Normal (0) Normal (0) High (1) Critical/ECP (101) Low (1) Normal (0) High (1) Internetwork Control (110) Normal (0) High (1) High (1) Network Control (111) Low (1) High (1) High (1) Total Length
Identification
Flags
Fragment Offset
TTL
Protocol
Protocol Field Description ICMP 1 Internet Control Message Protocol TCP 6 Transmission Control Protocol UDP 17 User Datagram Protocol Header Checksum
Source Address
Destination Address
Options
Purpose of IPv4 Header Fields
Significance of IPv4 Header
Frequently Asked Questions
Q1. What is IPv4 header format?
Q2. What is IPv4 format?
Q3. What is IPv6 header format?
Q4. What are the 12 basic header fields IPv4?
Conclusion