IAE Academy

GATE 2018 CS Q.54: solution and answer

GATE 2018 · CSQ.54 · 2 marks · NAT

Consider an IP packet with a length of 4,500 bytes that includes a 20-byte IPv4 header and a 40-byte TCP header. The packet is forwarded to an IPv4 router that supports a Maximum Transmission Unit (MTU) of 600 bytes. Assume that the length of the IP header in all the outgoing fragments of this packet is 20 bytes. Assume that the fragmentation offset value stored in the first fragment is 0.

The fragmentation offset value stored in the third fragment is ________.

See the question in the paper

Answer and solution

ANSWER

The fragmentation offset value stored in the third fragment is 144.

Official answer: 144Source: Official answer key, GATE 2018 CS (IIT Guwahati)

  1. The packet is 4,500 bytes including its 20-byte IPv4 header, so it carries bytes of data. The 40-byte TCP header is part of this data and is fragmented along with the rest of it.

  2. Each outgoing fragment may be at most 600 bytes, and each has a 20-byte IP header. That leaves at most data bytes per fragment.

  3. The fragment offset field counts in units of 8 bytes. So every fragment except the last must carry a multiple of 8 data bytes. The largest multiple of 8 that is at most 580 is bytes.

  4. The first two fragments carry bytes of data, so the third fragment starts at byte 1152 of the data. Its fragment offset field is .

KEY IDEA

The fragment offset is the starting byte of the fragment's data divided by 8. Every fragment except the last must carry a multiple of 8 data bytes, so the data per fragment is bytes.

WATCH OUT FOR

Using all 580 available bytes per fragment, which is not a multiple of 8. That gives an offset of . Another slip is subtracting the TCP header from the data, or forgetting to subtract the 20-byte IP header from 4,500.

From the GATE 2018 CS paper. Every question of this paper · Download the full paper · All 20 IPv4 questions, with notes

More IPv4 questions