IP HEADER


 

Version: Version of the IP protocol

IHL: (Internet Header Length) Total length of the Header
     Minimum value of the field is 5 x 4 bytes = 20 bytes
     Maximum value of the field is 15 x 4 bytes = 60 bytes
Type of Service: It indicates the quality of service
Total Length: Total length of the IP datagram in bytes including header and the data. It is 16 bit and it allows 65,535 bytes
Identification: If the datagram is fragmented, all fragments are in the unique value. The destination hosts will re-assemble the fragmented datagram with the identification number
Flags: It is a3 bit field and it is used to control or identify fragments.
     bit 0 = Reserved
     bit 1 = DF (Do not fragment) = If it is set to 1, it may not be fragmented
     bit 2 = MF (More fragments) = If it is set to 1, it may not be a single fragment
Fragment Offset: It is a 13 bit field. It indicates the relative position of each particular fragment. Its offset the original datagram in 8 bytes unit.
Example: Datagram of 3200 bytes is split into 3 fragments
     1st Fragment: Carries 1st 1400 bytes. Being 1st fragment, its offset value is 0
     2nd Fragment: Carries 2nd 1400 bytes. Its offset value is 175, why? bytes of prior fragments divided by 8
     3rd Fragment: Carries 3rd 400 bytes. Its offset value is 350, why? bytes of prior 2 fragments divided by 8
LANs and WANs have a limit the amount of data will be carried out in the frame at layer 2. That limit is called MTU (maximum transmission unit). But datagram is prepared at network layer, may be larger than MTU. In that case, datagram needs to fragmented before being passed to datalink layer.
Time to Live: It is a 8 bit field. It prevents the datagram from hang around endlessly. When TTL gets 0, the datagram will discarded
Protocol: It defines the upper layer protocol.
     Value of 6 indicates, tcp works on top of ip
     Value of 17 indicates, udp works on top of ip
     Value of 1 indicates, icmp works on top of ip
Header Checksum: The purpose of checksum is to detect corruption in transit. IP covers the checksum of header but not the data. Both source and destination should use the same algorithm for calculation
Source Address: IP address of source
Destination Address: IP address of destination
Options: 
Padding: It is used to ensure the TCP header ends and data begins on a 32 bit boundary. The padding is composed of zeros