IP Fragmentation

GATE CS previous year questions · 4 questions

GATE CS 2025 Set 1 | Question 57

NAT · 2 marks

Suppose a message of size 15000 bytes is transmitted from a source to a destination using IPv4 protocol via two routers as shown in the figure. Each router has a defined maximum transmission unit (MTU) as shown in the figure, including IP header. The number of fragments that will be delivered to the destination is ________ . (Answer in integer)

Source to Router-1 (MTU = 5000 bytes) to Router-2 (MTU = 3000 bytes) to Destination

Explanation

Answer: 7

Use the standard 20-byte IPv4 header. The data in every fragment except the last must be a multiple of 8 bytes, and routers never reassemble: each router only splits the packets it receives.

  • Router-1 (MTU 5000): at most \(5000 - 20 = 4980\) data bytes, i.e. 4976 as a multiple of 8. The 15000 bytes become \(4976 + 4976 + 4976 + 72\): 4 fragments.
  • Router-2 (MTU 3000): at most \(3000 - 20 = 2980\), i.e. 2976 data bytes. Each 4976-byte fragment splits into \(2976 + 2000\), but the last fragment (72 data bytes, 92 bytes with its header) already fits and passes through unchanged.

Fragments delivered \(= 3 \times 2 + 1 = 7\). The tempting \(4 \times 2 = 8\) wrongly splits the small fourth fragment again; even ignoring the multiple-of-8 rule (4980, 4980, 4980, 60) the count is 7.

Answer: 7

GATE CS 2025 Set 2 | Question 23

MCQ · 1 mark · −0.33

Consider a network that uses Ethernet and IPv4. Assume that IPv4 headers do not use any options field. Each Ethernet frame can carry a maximum of 1500 bytes in its data field. A UDP segment is transmitted. The payload (data) in the UDP segment is 7488 bytes.

Which ONE of the following choices has the CORRECT total number of fragments transmitted and the size of the last fragment including IPv4 header?

Options for GATE CS 2025 Set 2 | Question 23

Explanation

Answer: (D)

IP fragments the whole UDP segment, header included: \(8 + 7488 = 7496\) bytes of IP data.

A fragment has a 20-byte IPv4 header and must fit in 1500 bytes, so it carries at most 1480 data bytes. Since 1480 is a multiple of 8, as fragment offsets require, every fragment except the last carries exactly 1480 bytes.

  • Five full fragments carry \(5 \times 1480 = 7400\) bytes.
  • The remaining \(7496 - 7400 = 96\) bytes form a sixth fragment of \(96 + 20 = 116\) bytes.

Leaving out the UDP header gives 88 data bytes (108 bytes with the IP header), the trap in options B and C.

Answer: D

GATE CS 2024 Set 1 | Question 65

NAT · 2 marks

Consider sending an IP datagram of size 1420 bytes (including 20 bytes of IP header) from a sender to a receiver over a path of two links with a router between them. The first link (sender to router) has an MTU (Maximum Transmission Unit) size of 542 bytes, while the second link (router to receiver) has an MTU size of 360 bytes. The number of fragments that would be delivered at the receiver is ________

Explanation

Answer: 6

The datagram carries \(1420 - 20 = 1400\) bytes of data. Every fragment has its own 20-byte header, and every fragment except the last must carry a multiple of 8 data bytes.

  • First link (MTU 542): at most \(542 - 20 = 522\) data bytes, rounded down to 520. The data splits as \(520 + 520 + 360\), giving fragments of 540, 540 and 380 bytes.
  • Second link (MTU 360): at most \(360 - 20 = 340\) data bytes, rounded down to 336. Each 520-byte piece splits into \(336 + 184\), and the 360-byte piece into \(336 + 24\).

Routers do not reassemble fragments, so the receiver gets \(2 + 2 + 2 = 6\) fragments.

Answer: 6

GATE CS 2024 Set 2 | Question 28

MSQ · 1 mark

Which of the following statements about IPv4 fragmentation is/are TRUE?

Options for GATE CS 2024 Set 2 | Question 28

Explanation

Answer: (B), (C)

In IPv4, a datagram can meet a link with a smaller MTU anywhere on its path.

  • B is true and A is false: any router whose outgoing link cannot carry the datagram splits it into fragments, each with its own IP header and with the offset and more-fragments fields set. (Fragmenting only at the source is how IPv6 works.)
  • C is true and D is false: fragments of one datagram may take different routes, and a later link may have a larger MTU anyway, so routers forward fragments as independent datagrams. Only the destination host collects them, using the identification field and the offsets, and rebuilds the original datagram.

Answer: B, C