GATE / CS ARCHIVE

SIMILAR QUESTIONS / COMPUTER NETWORKS

Generate IPv4 fragments under an MTU

5 questions solved the same way, newest first. Back to Computer Networks

How these are solved

Subtract each IP header from MTU, round nonfinal payload to a multiple of eight, partition original payload, and derive counts, final size, MF and offsets. UDP header belongs to original IP payload only once; do not duplicate it per fragment.

1 mark · MCQ
Report issue

IP Addressing, Fragmentation & Address Resolution

Question 23, GATE 2025: Ethernet can carry at most 1500 bytes in its data field. IPv4 uses a 20-byte header with no options. A UDP datagram has 7488 bytes of application data. After IPv4 fragmentation, how many fragments are sent, and what is the total size of the last fragment including its IPv4 header?
Options: A. 5 and 1488 bytes; B. 6 and 88 bytes; C. 6 and 108 bytes; D. 6 and 116 bytes.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

Step through it (4 steps)

UDP adds one 8-byte header to its 7488 data bytes. The payload of the original IPv4 datagram is therefore 7496 bytes. Each fragment must fit the 1500-byte Ethernet data field, and each has its own 20-byte IPv4 header. A full fragment can consequently carry 1500−20=1480 payload bytes.

Except for the last fragment, IPv4 fragment payload lengths must be multiples of 8 because fragment offsets are in 8-byte units. Here 1480=185·8, so the full payload size is usable. Divide the original payload: 7496=5·1480+96. There are five full fragments and one final fragment, hence six in total. The last has 96 payload bytes plus a 20-byte IPv4 header, or 116 bytes.

The UDP header is part of the original payload and appears only in the first fragment, not in every fragment. Omitting it would incorrectly give 88 bytes of last payload and 108 bytes including IP; 88 alone would additionally omit the final IP header. Answer: D.

Original paper, page 20 · Answer key

2 marks · NAT
Report issue

IPv4 fragment offset

IP Addressing, Fragmentation & Address Resolution

Question 54, GATE 2018: An IPv4 packet is 4500 bytes including a 20-byte IP header and 40-byte TCP header. Router MTU is 600 bytes; each fragment has a 20-byte IP header and the first offset is zero. Find the third fragment’s stored offset.
Tap to enlarge
Answer & solution

Official answer: 144

Step through it (4 steps)

Method

Fragment offset is measured in eight-byte units from the original IP payload start, not from the original IP header. A full fragment may hold 580 payload bytes by MTU, but a nonfinal fragment must end on an eight-byte boundary, so round down to 576. The first occupies payload bytes 0–575, the second 576–1151, and the third starts at 1152. Their stored offsets are 0,72,144. The TCP header travels as part of the first payload, without a new TCP header in later fragments.

Solution

Each fragment has room for 600−20=580 payload bytes. Nonfinal payload lengths must be multiples of 8, so use 576 bytes per full fragment. The third fragment starts after 2*576=1152 bytes of original IP payload, giving stored offset 1152/8=144. The40-byte TCP header is part of the IP payload and is not repeated or subtracted from every fragment. Fragmentation is assumed permitted, as the question prescribes outgoing fragments.

Original paper, page 22 · Answer key

2 marks · NAT
Report issue

IP Addressing, Fragmentation & Address Resolution

Question 53, GATE 2016: A router receives a 1000-byte IP datagram, including a 20-byte IP header, and must forward it over a link of MTU 100 bytes. Find the number of fragments, assuming IPv 4 fragmentation is permitted and each fragment has a 20-byte header.
Tap to enlarge
Answer & solution

Official answer: 13.0 : 13.0

Our answer: 13

Step through it (4 steps)

The original datagram contains 1000−20=980 payload bytes. Each fragment can hold 100−20=80 payload bytes, already a multiple of 8 as required for nonfinal IPv 4 fragments. Twelve fragments carry 960 bytes and a thirteenth carries 20, so 13 fragments. This assumes IPv 4 fragmentation is permitted (DF=0); otherwise the router drops rather than fragments the datagram.

The MTU bounds each entire fragment, including its own header. Thus divide the 980-byte payload by 80, not the original 1000-byte datagram by 100. Each nonfinal fragment's payload must be a multiple of 8 for IPv 4 fragment offsets, and 80 already qualifies. The last fragment has 20 payload bytes plus its 20-byte header, for 40 bytes total; the other twelve total 100 bytes each. Repeated headers make aggregate transmitted bytes 1240, which is larger than the original datagram.

Original paper, page 20 · Answer key

2 marks · MCQ
Report issue

IP Addressing, Fragmentation & Address Resolution

Question 37, GATE 2015: UDP user data 8880 bytes, UDP header 8 bytes, IPv4 header 20 bytes, no options, Ethernet MTU1500. Find number of IPv4 fragments and final fragment offset: A6, 925; B6, 7400; C7, 1110; D7, 8880.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Step through it (4 steps)

IP payload includes the 8-byte UDP header, totaling 8888 bytes. Each full fragment holds 1500−20=1480 bytes, a multiple of 8. Six hold 8880 bytes, leaving 8 bytes for a seventh. Its offset is 8880/8=1110. Thus 7 fragments and 1110, C.

Fragmentation splits the IP payload, which already includes the entire UDP header:8880+8=8888 bytes. Each fragment gets its own 20-byte IP header, leaving 1480 payload bytes within the 1500MTU.1480 is divisible by 8, so six full payloads consume 8880 bytes and an 8-byte remainder requires a seventh fragment. The final fragment begins after 8880 original-IP-payload bytes; divide by the 8-byte offset unit to get 1110. Omitting the UDP header incorrectly gives only six fragments.

Original paper, page 38 · Answer key

2 marks · MCQ
Report issue

IP Addressing, Fragmentation & Address Resolution

Question 28, GATE 2014: A router with MTU 1500 bytes receives a 4404-byte IPv4 packet whose header is 20 bytes. What are the third fragment's (MF,total length,offset) fields? A (0,1444,370); B (1,1424,185); C (1,1500,370); D (0,1424,2960).
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Step through it (4 steps)

Step 1: Remove the original header to get 4404−20=4384 payload bytes. Each full fragment can carry 1500−20=1480 bytes; this is a multiple of eight, as required for nonfinal fragment payloads. Step 2: Two full fragments carry 2960 payload bytes, leaving 4384−2960=1424 bytes for the third fragment. Add its own 20-byte header: total length 1444. Step 3: Its starting payload offset is 2960 bytes, stored in eight-byte units as 2960/8=370. It is the last fragment, so MF=0. Therefore A, assuming fragmentation is permitted and the arriving packet is an unfragmented original.

Original paper, page 59 · Answer key