devxlogo

What is the anatomy of an IP datagram?

What is the anatomy of an IP datagram?

Question:
What is the anatomy of an IP datagram?

Answer:
The minimum length of the IP header is 20 bytes.

Version:
Four bits are reserved for the IP version information. We are currently at Version 4.
Length:
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:

For precedence:

000Routine
001Priority
010Immediate
011Flash
100Flash override
101Critical
110Internetwork control
111Network control

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).
Identification:
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.
Flags:
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.
Protocol:
This field indicates the higher-level protocol to which IP should deliver the contents of the datagram. Some examples are:

0:Reserved
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
Options:
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:

Padding:
When options are used, zeros are padded till the next 32-bit boundary.
Data:
The information that needs to be provided to the next higher layer, as specified in the protocol field.

See also  Why ChatGPT Is So Important Today
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist