IPv4 Datagram Format

let's talk about each field in IPv4 Header:

1. Version: This is a 4-bit field, tells which version of IP we are using.

2. Header:

with 4 bit maximum header size is (in binary) = 1111 =  15 (in decimal)

So minimum header length= 20 Bytes and if you are completely using the options field then 20+ 40 = 60 Bytes (maximum header length.

Some times it is represented in multiple of 4. 

Example: if header length given is less than 20 then we have to multiply that with 4.

 

3. Total length(16 bit)

The total length field defines the total length of the datagram including the header.

 total length= data length + header length

                        or

data length = total length - header length

4. Identification Bit(16 bit):

Since we know that IPv4 is a datagram service, So these bits helps in uniquely identifying the datagrams when fragmentation is done on packets.

 

5. Fragmentation Bit (13 bits): Important when we discussed fragmentation topic.

 

6.TTL(8 bits):-

  • TTL stands for Time to Live.
  • It is not time actually. It is a hop distance. Every time you visit a hop it is decreased by one.
  • Useful in avoidance of datagram looping.

7. Protocols(8bits):

Since IPv4 contains data from the various protocol. This field helps the network layer to understand, which data belongs to which protocol. 

Sometimes it helps in discarding the packets on the basis of the protocol they follow. Ex:

ICMP, IGMP, UDP, TCP

ICMP is discarded first and TCP is discarded at last.

 

8. Checksum(16 bits): This field is used to detect the errors in the packets or messages.

 

9. Types of Services(8 bits): 

First 3 bits tell the precedence and next 4 bits tells the type of service and last bits is of no used.

Following table shows default service types.

 

Contributor's Info

Created:
0Comment
INTERNET PROTOCOL (IP)

Any electronic device which is capable of sharing data with other devices is called a node. A set of such nodes is called a network and the links or wires which connect these nodes are referred to as the communication channels. Any network containing more than one smaller network is called the internet.

Protocol is simply a set of rules to perform some specific task. For example, setting some rules to manage any organization is nothing but the management protocol of that organization.

Internet Protocol is one of the inevitable protocols in a device. When a device shares some data or information with one or more devices, the data passes through some layers present in the device. These layers are implemented on software level and each layer contains different protocols. Each layer is assigned some specific tasks to perform on data. One of these layers is Network layer which consists of the IP.

The main responsibilities of IP are routing, congestion control, host to host connection establishment and fragmentation of data.

  • Routing means deciding the path for data packets to travel to destination, as there may be intermediary devices (usually routers) connected between the hosts.
  • Congestion control refers to keeping control of the amount of data sent by the communication channel to receiver and the amount depends on the capability of channel as well as the buffer size of destination host.
  • Fragmentation is the process of splitting the data packets into smaller packets because maximum size of IP datagram is 65535, but the data link layer protocol generally imposes a limit that is much smaller. This limit is called the MTU(Maximum Transfer Unit). Fragmentation can be done at the sender or at intermediate routers. The same datagram can be fragmented several times. Reassembly of original datagram is only done at destination hosts.
  • IP is responsible for a host to host connection between the source and destination which is done with the help of IP addresses of the nodes.

IP provides an unreliable, connectionless, best-effort service which is also referred as the datagram service. This leads to an out-of-sequence delivery of packets and the issue of duplicate packets.

  • IP does not provide any guarantee to deliver the packet to its destination which means the packet may get lost in its way and IP does not support any flow control or error recovery algorithm. That's why this protocol is unreliable.
  • A connectionless protocol is a form of data transmission in which the data goes out automatically without determining whether the receiver is ready, or even whether a receiver exists. IP follows this characteristic that's why it is connectionless.
  • IP is Best-Effort service because it does not take guarantees on the service i.e. no features to retransmit the lost and/or corrupted data packets.

Current version of IP is IPv4 but a more advance version is IPv6 which is not very popular now due to inconveniences of adapting a change in all the existing networking devices

At each layer some additional data(information) is added in the original data(payload) as a header or trailer. Format of the IPv4 datagram is:

The size of header lies between 20 bytes(when option are 0 bytes) to 60 bytes(when options are 40 bytes). The size of the datagram lies between 20 bytes to 2^16 bytes(65536).

Contributor's Info

Created:
0Comment