written 5.9 years ago by |
Datagrams:
Packets in the network (internet) layer are called datagrams. Figure 7.2 shows the IP datagram format. A datagram is a variable-length packet consisting of two parts: header and data. The header is 20 to 60 bytes in length and contains information essential to routing and delivery.
Fig1: IP datagram
Version (VER) :
i. This 4-bit field defines the version of the IP protocol. Currently the version is 4.
ii. This field tells the IP software running in the processing machine that the datagram has the format of version 4.
iii. All fields must be interpreted as specified in the fourth version of the protocol.
Header length (HLEN):
i. This 4-bit field defines the total length of the datagram header in 4-byte words. This field is needed because the length of the header is variable (between 20 and 60 bytes).
ii. When there are no options, the header length is 20 bytes, and the value of this field is 5 (5× 4= 20).
iii. When the option field is at its maximum size, the value of this field is 15 (15× 4= 60).
Service type:
i. In the original design of IP header, this field was referred to as type of service (TOS), which defined how the datagram should be handled.
ii. Part of the field was used to define the precedence of the datagram; the rest defined the type of service (low delay, high throughput, and so on). IETF has changed the interpretation of this 8-bit field.
iii. This field now defines a set of differentiated services. In this interpretation, the first 6 bits make up the code point subfield and the last2 bits are not used.
Total length:
i. This is a 16-bit field that defines the total length (header plus data) of the IP datagram in bytes. To find the length of the data coming from the upper layer, subtract the header length from the total length.
ii. The header length can be found by multiplying the value in the HLEN field by four. Length of data= total length− header length
iii. Since the field length is 16 bits, the total length of the IP datagram is limited to 65,535 (216− 1) bytes, of which 20 to 60 bytes are the header and the rest is data from the upper layer.
iv. The total length field defines the total length of the datagram including the header.
v. Though a size of 65,535 bytes might seem large, the size of the IP datagram may increase in the near future as the underlying technologies allow even more throughput (more bandwidth).
Identification: This field is used in fragmentation.
Flags: This field is used in fragmentation (discussed in the next section).
Fragmentation offset: This field is used in fragmentation.
Time to live:
i. A datagram has a limited lifetime in its travel through an internet.
ii. This field was originally designed to hold a timestamp, which was decremented by each visited router.
iii. The datagram was discarded when the value became zero. However, for this scheme, all the machines must have synchronized clocks and must know how long it takes for a datagram to go from one machine to another.
Protocol:
i. This 8-bit field defines the higher-level protocol that uses the services of the IP layer.
ii. An IP datagram can encapsulate data from several higher level protocols such as TCP, UDP, ICMP, and IGMP. This field specifies the final destination protocol to which the IP datagram should be delivered.
iii. In other words, since the IP protocol multiplexes and demultiplexes data from different higher-level protocols, the value of this field helps in the demultiplexing process when the datagram arrives at its final destination.
Checksum:
i. The error detection method used by most TCP/IP protocols is called the checksum.
ii. The checksum protects against the corruption that may occur during the transmission of a packet. It is redundant information added to the packet.
iii. The checksum is calculated at the sender and the value obtained is sent with the packet.
iv. The receiver repeats the same calculation on the whole packet including the checksum. If the result is satisfactory (see below), the packet is accepted; otherwise, it is rejected.
Source address:
i. This 32-bit field defines the IP address of the source.
ii. This field must remain unchanged during the time the IP datagram travels from the source host to the destination host.
Destination address:
i. This 32-bit field defines the IP address of the destination.
ii. This field must remain unchanged during the time the IP datagram travels from the source host to the destination host.