Question

The maximum number of IPv4 router addresses that can be listed in the record route (RR) option field of an IPv4 header is

Official answer and solution
Official answer
9
From
Official GATE 2017 answer key

Solution

Calculate the maximum byte space available for IPv4 header options and determine how many 4-byte IP addresses fit into the Record Route option.

Calculate available space in the IPv4 header:

  1. The Internet Header Length (IHL) field is 4 bits, with a maximum value of 11112=151111_2 = 15. Since IHL counts length in 32-bit (4-byte) words, the maximum total IPv4 header length is:
15×4=60 bytes15 \times 4 = 60 \text{ bytes}
  1. The mandatory base IPv4 header is 20 bytes.
  2. The maximum space available for options is:
60−20=40 bytes60 - 20 = 40 \text{ bytes}

Examine the format of the Record Route (RR) option:

  • Option Type (Code): 1 byte (value 7)
  • Option Length: 1 byte
  • Pointer: 1 byte

Total overhead for the RR option fields is 1+1+1=31 + 1 + 1 = 3 bytes.
The remaining bytes available for storing router IPv4 addresses are:

40−3=37 bytes40 - 3 = 37 \text{ bytes}

Each IPv4 address occupies 4 bytes. Therefore, the maximum number of router addresses that can be listed is:

⌊374⌋=9\left\lfloor \frac{37}{4} \right\rfloor = 9
Final answer

9

Common trap

Dividing 40 bytes directly by 4 without subtracting the 3-byte header overhead (Code, Length, Pointer) of the Record Route option.

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2017 Computer Science and Information Technology (CS) Session 2
Question
20 of 65, printed as CS Q.20
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.