IPV4 header format is 20 to 60 bytes in length. It contains information need for routing and delivery. It consists of 13 fields such as Version, Header length, total distance, identification, flags, checksum, source IP address, destination IP address. It provides essential data need to transmit the data. LE Following are various components/fields of IP packet header
Version: The first IP header field is a 4-bit version indicator. In IPv4, the value of its four bits is set to 0100, which indicates 4 in binary. However, if the router does not support the specified version, this packet will be dropped.
Internet Header Length: Internet header length, shortly known as IHL, is 4 bits in size. It is also called HELEN (Header Length). This IP component is used to show how many 32-bit words are present in the header.
Type of Service: Type of Service is also called Differentiated Services Code Point or DSCP. This field is provided features related to the quality of service for data streaming or VoIP calls. The first 3 bits are the priority bits. It is also used for specifying how you can handle Datagram.
Total length: The total length is measured in bytes. The minimum size of an IP datagram is 20 bytes and the maximum, it can be 65535 bytes . HELEN and Total length can be used to calculate the dimension of the payload. All hosts are required to be able to read 576-byte datagrams. However, if a datagram is too large for the hosts in the network, the fragmentation method is widely used.
Identification: Identification is a packet that is used to identify fragments of an IP datagram uniquely. Some have recommended using this field for other things like adding information for packet tracing, etc.
IP Flags: Flag is a three-bit field that helps you to control and identify fragments. The following can be their possible configuration:
Bit 0: is reserved and has to be set to zero
Bit 1: means do not fragment
Bit 2: means more fragments.
Fragment Offset: Fragment Offset represents the number of Data Bytes ahead of the particular fragment in the specific Datagram. It is specified in terms of the number of 8 bytes, which has a maximum value of 65,528 bytes.
Time to live: It is an 8-bit field that indicates the maximum time the Datagram will be live in the internet system. The time duration is measured in seconds, and when the value of TTL is zero, the Datagram will be erased. Every time a datagram is processed its TTL value is decreased by one second. TTL are used so that datagrams are not delivered and discarded automatically. The value of TTL can be 0 to 255.
Protocol: This IPv4 header is reserved to denote that internet protocol is used in the latter portion of the Datagram. For Example, 6 number digit is mostly used to indicate TCP, and 17 is used to denote the UDP protocol.
Header Checksum: The next component is a 16 bits header checksum field, which is used to check the header for any errors. The IP header is compared to the value of its checksum. When the header checksum is not matching, then the packet will be discarded.
Source Address: The source address is a 32-bit address of the source used for the IPv4 packet.
Destination address: The destination address is also 32 bit in size stores the address of the receiver.
IP Options: It is an optional field of IPv4 header used when the value of IHL (Internet Header Length) is set to greater than 5. It contains values and settings related with security, record route and time stamp, etc. You can see that list of options component ends with an End of Options or EOL in most cases.
Data: This field stores the data from the protocol layer, which has handed over the data to the IP layer.
Bit 1: means do not fragment Bit 2: means more fragments.