What is the anatomy of an IP datagram?
The minimum length of the IP header is 20 bytes.
- Four bits are reserved for the IP version information. We are currently at Version 4.
- This four-bit field specifies the length of the IP header as counted in 32-bit quantities.
- Type of Service:
- An eight-bit field that indicates the quality of service for this datagram as follows:
|D||Specifies if the datagram has to be delayed; 0 means normal, 1 means no delay.|
|T||Type of throughput desired; 0 for normal, 1 for high|
|R||Reliability of transmission. In reality this should not apply to IP because it is inherently unreliable. However, it can apply to the choice of the physical network itself.|
Resvd. is for future use.
- Total Length:
- This field specifies the total length, in bytes, of the IP datagram (header and data).
- This field contains a unique number that assists in the reassembly of a fragmented datagram. If a datagram is fragmented, all fragments will bear the same identification number.
- This three-bit field is interpreted as follows:
|0:||Reserved, always 0|
|1:||The don’t-fragment bit; 1 – do not fragment; 0 – fragmentation allowed|
|2:||The more fragments bit; 1 – more fragments; 0 – last fragment|
- Fragment Offset:
- This field is used in the reassembly of fragments. The value contained here reflects the number of 64-bit sections without counting the header bytes that were contained in the earlier fragments. Therefore, for the first fragment, this value is always 0.
- Time to Live:
- This values specifies the time in seconds that the datagram is allowed to travel. During the journey of the IP datagram, each IP router along the route will check this field and subtract from it the processing time for the datagram. Typically a router is able to process the information in the datagram in less than one second, but subtracts one anyway. Therefore this value can be construed as a hop count metric. If a router recognizes that the TTL value has decremented to 0, it assumes the IP datagram is traveling in a closed loop and will discard the datagram.
- This field indicates the higher-level protocol to which IP should deliver the contents of the datagram. Some examples are:
|1:||ICMP (Internet Control Message Protocol)|
|3:||GGP (Gateway to Gateway Protocol)|
|6:||TCP (Transmission Control Protocol)|
|80:||ISO-IP (ISO Internet Protocol)|
- Header Checksum:
- This field contains the checksum information for the IP header only. This 16-bit field is populated as follows: It contains the 16-bit one’s complement of the one’s complement sum of all 16-bit words in the header.
- Source IP Address:
- The 32-bit IP address for the datagram’s source.
- Destination IP Address:
- The 32-bit IP address for the datagram’s destination
- This is a variable length field. IP implementations are not mandated to be capable of generating options but they must be able to process them if they exist in the datagram. The option field is sub-divided into code, length and option data as follows:
- When options are used, zeros are padded till the next 32-bit boundary.
- The information that needs to be provided to the next higher layer, as specified in the protocol field.