IP Header Format:
I) Version: This Field defines the version of IP. It is Static 4 bit value.
II) Header Length: This Field defines the length of the datagram header. It is 4 bit value.
III) Type of Service: It is 8 bit value. It is used tell the network how to treat the IP packet.
These bits are generally used to indicate the Quality of Service (QoS) for the IP Packet.
IV) Packet Length: 16 bit value indicating the size of the IP Packet in terms of bytes. This
gives a maximum packet size of 65536 bytes.
V) Identification: 16 bit field used for reassembling the packet at the destination.
VI) Flags: It is 3 bits value. It indicates if the IP packet can be further fragmented or not and if
the packet is the last fragment or not of a larger transfer.
VII) Fragment offset: 13 bit value used in the reassembly process at the destination.
VIII) Time to Live: 8 bit value telling the network how long an IP packet can exist in a network
before it is destroyed.
IX) Protocol: 8 bit value used to indicate the type of protocol being used (TCP, UDP etc.).
X) Header checksum: It is 16 bit value. It is used to indicate errors in the header only. Every
node in the network has to check and re-insert a new checksum as the header changes at
every node.
XI) Source address: 32 bit value representing the IP address of the sender of the IP packet.
XII) Destination address: 32 bit value representing the IP address of the packets final
destination.
XIII) Options: Options are not required for every datagram. They are used for network testing
and debugging.
XIV) Padding: Variable size bit field. These bits are used to ensure a 32 bit boundary for the
header is achieved.
Example:
If value at HLEN field is 1101 find the size of option and padding field.
HLEN Value = 1101 = 13 Bytes.
Total No. of Bytes in the Header = 13 x 4 = 52 Bytes.
The first 20 bytes are the main header and the next 32 bytes are the options + Padding Field.