educative.io

How 4 bit field contain 32-bit words ? Help me understand

  • A 4 bit IP Header Length (IHL) that indicates the length of the IP header in 32-bit words. This field allows IPv4 to use options if required, but as it is encoded as a 4 bits field, the IPv4 header cannot be longer than 64 bytes.

Type your question above this line.

Course: https://www.educative.io/collection/10370001/6105520698032128
Lesson: https://www.educative.io/collection/page/10370001/6105520698032128/4886867558268928

Hello @Thalha_S,

The IP Header Length (IHL) field indicates the length of the IP header, which would be 32 bits (4 bytes). IHL is the field that notifies us about the size of the IP header. It does not contain the 32-bit words in it.

For Example:

IHL

0000 => 0 bits = 0 bytes
0001 => 32 bits = 4 bytes
0010 => 64 bits = 8 byes
0011 => 96 bits = 12 bytes
0100 => 128 bits = 16 bytes
0101 => 160 bits = 20 bytes ==> minimal value (header without data)
0110 => 192 bits = 24 bytes

1111 => 480 bits = 60 bytes ==> maximum value

By the calculation, in the above example, we can say that if the IHL field has all the bits are zeros, then the length of the IP Header will be 0 bytes. And if all the bits of the IHL field are ones, then the length of the IP Header will be 60 bytes, which is the maximum value if we do not include the datagram size.

I hope I have answered your query; please let me know if you still have any confusion.

Thank You :blush: