How many bits wide is the Internet Header Length (IHL) field in an IPv4 header?
2012
How many bits wide is the Internet Header Length (IHL) field in an IPv4 header?
Answer: B. 4 — ConceptAn IPv4 header contains fixed-width fields. The Internet Header Length (IHL) field stores the header length as a count of 32-bit words, so its width…
- A.
2
- B.
4
- C.
8
- D.
16
Attempted by 217 students.
Show answer & explanation
Correct answer: B
Concept
An IPv4 header contains fixed-width fields. The Internet Header Length (IHL) field stores the header length as a count of 32-bit words, so its width determines the range of word counts that can be encoded.
An unsigned field of n bits has 2n possible bit patterns, representing values from 0 to 2n − 1.
Application
RFC 791 allocates 4 bits to the IHL field.
A 4-bit unsigned field represents values from 0 to 15; valid IPv4 headers use IHL values from 5 to 15 because the minimum header has five 32-bit words.
Five words multiplied by 4 bytes per word gives 20 bytes, while fifteen words multiplied by 4 bytes per word gives 60 bytes.
Cross-check
The minimum and maximum IPv4 header sizes, 20 bytes and 60 bytes, correspond exactly to IHL values 5 and 15 within this field.
Result
Therefore, the IHL field is 4 bits wide.
Contrast
A 2-bit width provides only four bit patterns, covering values 0 through 3.
A 4-bit width provides sixteen bit patterns, covering values 0 through 15.
An 8-bit width provides 256 bit patterns, covering values 0 through 255.
A 16-bit width provides 65,536 bit patterns, covering values 0 through 65,535.