Tuesday 15 January 2013

IPv4 Datagram

A datagram is a basic unit of packet switched network, or simply the packet at network layer is known as datagram. A datagram has two parts one header part and one data part. The header contains information that used to route the packet from source to destination. The header part has variable length with minimum 20 byte and maximum of 60 byte. The maximum size of a datagram is 65535 byte, and minimum size is 20 byte. The typical structure of a datagram header is shown below,
Datagram Structure
Datagram Structure 

1. Version (VER)

This field defines the version of the IPv4 protocol. The common used version is 4 the version 6 also used. While passing packets through nodes, each node processes the packet according to the version. If an intermediate machine is using some other version rather than specified in the packet, then the datagram is discard by that machine instead of processing.


2. Header length (HLEN)
This field defines the total length of the datagram header. We know that the length of a packet header can vary from 20 to 60 bytes. Here use only 4 bits to represent the header length. So to get the correct header length we must multiply the 4-bits value with 4. Minimum value is 5*4=20 and maximum value is 15*4=60.

3. Services
These 8-bits are interpreted either service type (old) or differentiated services (new). Both of them are explain below,


Service type and Differentiate Services
Service type and Differentiate Services

Service Type

In this approach, the first 3 bits are called precedence bits. The next 4 bits are known as type of service (TOS) bits, and the last bit is not used. Precedence bits are used to specify the priority of the datagram.  The TOC bits are interpreted as follow;

0000       Normal (default)
0001       Minimize cost
0010       Maximize reliability
0100       Maximize throughput
1000       Minimize delay

Differentiated Services
The first 6 bits known as the codepoint and the last 2 bits are not used. The codepoint subfield in two ways:
If the 3 rightmost bits are Os, the 3 leftmost bits are used to represent priority In other words.
If the 3 rightmost bits are not all Os, the 6 bits define 64 services based on the priority assignment by the Internet authority (code point XXXXX0) or local authority (code point XXXX11) or experimental (code point XXXX01).

4. Total length

This field represents the total length of the IPv4 datagram in bytes. Total length is the sum of header length and data length. We know that the length of the header is varying from 20 bytes to 60 bytes. Therefore, the datagram have at least 20 bytes length.

          Total length=header length + length of the data

5. Identification
    This field is used in fragmentation.
6. Flags
     This field is used in fragmentation.
7. Fragmentation offset
      This field is used in fragmentation.

We discuss fragmentation in next section.

8. Time to Live
    This field usually used to represent the maximum number hops a datagram can travel before reach to destination. At each hop or router, decrement the value of datagram by one. If the value of this field becomes zero then the datagram simply discard by the router.

9. Protocol
Value of this field represents the higher-level protocol at destination to which the datagram will deliver. The receiving node use this field to determine to which protocol the data must deliver.
1     ICMP
2     IGMP
6     TCP
17   UDP
89   OSPF


10. Checksum

Value of this field used error handling

11. Source Address
This field represents the 32-bit source node address.

12. Destination Address
This field represents the destination address. Both source and destination addresses are remain unchanged during the transmission of datagram.



No comments:

Post a Comment