Ads Here

Saturday, December 9, 2017

Internet Protocol : IP Datagram

Packets in the network (internet) layer are called datagrams

A datagram (datagram format is as shown below ) 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. 

A brief description of each field is in order.

-Version (VER).
  • This is a 4-bit field defines the version of the IP protocol. 
  • This field tells the version of IP, the software running in the processing machine to process all the fields must be interpreted as specified in the version of the protocol.
-Header length (HLEN).
  • This 4-bit field defines the total length of the datagram header in 4-byte words.
  • When there are no options, the header length is 20 bytes, and the value of this field is 5 (5× 4 = 20). When the option field is at its maximum size, the value of this field is 15 (15 × 4 = 60).

-Service type.
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. 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). 

a. When the 3 right-most bits are 0s, the 3 left-most bits are interpreted as the precedence bits in the service type. The precedence defines the eight-level priority of the datagram (0 to 7) in issues such as congestion. If a router is congested and needs to discard some datagrams, those datagrams with lowest precedence are discarded first.

b. When the 3 right-most bits are not all 0s, the 6 bits define 56 (64 − 8) services based on the priority assignment by the Internet or local authorities according to Table shown below. The first category contains 24 service types; the second and the third each contain 16. The first category is assigned by the Internet authorities (IETF). The second category can be used by local authorities (organizations). The thirdcategory is temporary and can be used for experimental purposes.

-Total length. This is a 16-bit field that defines the total length (header plus data) of the IP datagram in bytes.

  • This 16-bit field identifies a datagram originating from the source host. 
  • To guarantee uniqueness, the IP protocol uses a counter to label the datagrams. The counter is initialized to a positive number. When the IP protocol sends a datagram, it copies the current value of the counter to the identification field and increments the counter by one. 
  • As long as the counter is kept in the main memory, uniqueness is guaranteed. 
  • When a datagram is fragmented, the value in the identification field is copied into all fragments. In other words, all fragments have the same identification number, which is also the same as the original datagram. 
  • The identification number helps the destination in reassembling the datagram. It knows that all fragments having the same identification value should be assembled into one datagram.

  • This is a three-bit field. 
  • The first bit is reserved (not used). 
  • The second bit is called the do not fragment bit. If its value is 1, the machine must not fragment the datagram. If it cannot pass the datagram through any available physical network. If its value is 0, the datagram can be fragmented if necessary. 
  • The third bit is called the more fragment bit. If its value is 1, it means the datagram is not the last fragment; there are more fragments after this one. If its value is 0, it means this is the last or only fragment.

-Fragmentation offset.
  • This 13-bit field shows the relative position of this fragment with respect to the whole datagram. It is the offset of the data in the original datagram measured in units of 8 bytes. 
  • The following Figure shows a datagram with a data size of 4000 bytes fragmented into three fragments. The bytes in the original datagram are numbered 0 to 3999. The first fragment carries bytes 0 to 1399. The offset for this datagram is 0/8 = 0. The second fragment carries bytes 1400 to 2799; the offset value for this fragment is 1400/8 = 175. Finally, the third fragment carries bytes 2800 to 3999. The offset value for this fragment is 2800/8 = 350.

-Time to live. A datagram has a limited lifetime in its travel through an internet. This field was  originally designed to hold a timestamp, which was decremented by each visited router. 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.
Today, this field is mostly used to control the maximum number of hops (routers) visited by the datagram. When a source host sends the datagram, it stores a number in this field. This value is approximately two times the maximum number of routes between any two hosts. Each router that processes the datagram decrements this number by one. If this value, after being decremented, is zero, the router discards the datagram.

-Protocol. This 8-bit field defines the higher-level protocol that uses the services of the IP layer. 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.

  • The error detection method used by most TCP/IP protocols is called the checksum.
  • The checksum protects against the corruption that may occur during the transmission of a packet. It is redundant information added to the packet.
  • The checksum is calculated at the sender and the value obtained is sent with the
    packet. 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. This 32-bit field defines the IP address of the source. This field must remain unchanged during the time the IP datagram travels from the source host to the destination host.

-Destination address. This 32-bit field defines the IP address of the destination. This field must remain unchanged during the time the IP datagram travels from the source host to the destination host.

Options, as the name implies, are not required for a datagram. They can be used for network testing and debugging. Although options are not a required part of the IP header, option processing is required of the IP software. This means that all implementations must be able to handle options if they are present in the header.

FormatIt is composed of a 1-byte type field, a 1-byte length field, and a variable-sized value field. The three fields are often referred to as type-length-value or TLV.

TypeThe type field is 8 bits long and contains three subfields: copy, class, and number.

Copy. This 1-bit subfield controls the presence of the option in fragmentation.
When its value is 0, it means that the option must be copied only to the first frag-
ment. If its value is 1, it means the option must be copied to all fragments.

Class. This 2-bit subfield defines the general purpose of the option. When its value is 00, it means that the option is used for datagram control. When its value is 10, it means that the option is used for debugging and management. The other two possible values (01 and 11) have not yet been defined.

Number. This 5-bit subfield defines the type of option. Although 5 bits can define
up to 32 different types, currently only 6 types are in use.

The length field defines the total length of the option including the type field and the length field itself. This field is not present in all of the option types.

The value field contains the data that specific options require. Like the length field, this

No comments:

Post a Comment