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


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 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