in Computer Networks retagged by
18,985 views
43 votes
43 votes
Consider an IP packet with a length of $4,500\;\text{bytes}$ that includes a $20\text{-byte}\;\textsf{IPv4}$ header ans $40\text{-byte}$ TCP header. The packet is forwarded to an $\textsf{IPv4}$ router that supports a Maximum Transmission Unit (MTU) of $600\;\text{bytes}$. Assume that the length of the IP header in all the outgoing fragments of this packet is $20\;\text{bytes}$. Assume that the fragmentation offset value stored in the first fragment is $0$.

The fragmentation offset value stored in the third fragment is ________.
in Computer Networks retagged by
by
19.0k views

4 Comments

To solve these type of qs, just notice what packet is being forwarded. If it’s an IP packet, then subtract only the IP Header. No need to subtract the TCP header, because TCP header was added at the Transport Layer and $\textsf{IPv4}$ router does not have Transport layer.
1
1
1
1
edited by

In IP fragmentation questions,we donot need to worry about TCP,UDP headers, basically routers processes the fragments and it donot need to even look at TCP,UDP header, so we will not append them to each fragment .TCP,UDP header is just a part of payload i.e treated as usual data, and is present in the first fragment only
The attached slide of UC Berkley can be referred

,

1
1

8 Answers

82 votes
82 votes
Best answer

Packet Length $= 4500\;\textsf{B}$

IP Payload $= 4500-20 = 4480\;\textsf{B}$

MTU $= 600\;\textsf{B}$
MTU Payload $= 600\;\textsf{B} -20\;\textsf{B} = 580\;\textsf{B}$
But payload should be multiple of $8$ so number nearest to $580$ and multiple of $8$ is $576$, so MTU payload $= 576\;\textsf{B}$
IP Packet size $= 576\;\textsf{B} + 20\;\textsf{B} = 596\;\textsf{B}$
Size of Offset $= \frac{576}{8} = 72$

  • $1^{\text{st}}$ fragment offset  $= 0$
  • $2^{\text{nd}}$ fragment offset  $= 72$
  • $3^{\text{rd}}$ fragment offset  $= 144$
edited by

4 Comments

1
1
We have only 13 fragmentation offset bits thats why we need to divide by 8 to make total of 16 bits.
0
0
silly thing but may be useful to some one

To find the nearest number divisible by 8 of any number first find the mod of the number using gate calculator(it is available top left corner) then subtract that remainder with the number done you got  the nearest number.
1
1
38 votes
38 votes

IP Packet $=$ Data $+$ Header

i.e $4500$ bytes $= 4480$ (Data) $+ 20$ (Header) bytes [Given]

Now MTU is $600$ bytes.

MTU includes Data $+$ Header

$\therefore$ Max data that can be sent is $580$ bytes.

However, the total length should be a multiple of $8$ (except for the last fragment), because this number will be stored in the Fragmentation offset, which specifies the number of bytes ahead of this fragment.

The nearest number to $580$ which is a multiple of $8$ is $576$

Therefore, the fragmentation will be done in this way $\Rightarrow$

$\begin{array}{l|c|c|c|c|c|c|c|c} \hline \text{Fragment#} & 1 & 2 & \textbf{3} & 4 & 5 & 6 & 7 & 8 \\\hline \text{Data(B)} & 576 & 576 & \textbf{576} & 576 & 576 & 576 & 576 & 448 \\\hline \text{Header Length(B)} & 20 & 20 & \textbf{20} & 20 & 20 & 20 & 20 & 20 \\\hline \text{Total Length(B)} & 596 & 596 & \textbf{596} & 596 & 596 & 596 & 596 & 468 \\\hline \text{Fragment Offset(B)} & 0 & 72 & \textbf{144} & 216 & 288 & 360 & 432 & 504 \\\hline \text{More Fragement} & 1 & 1 & \textbf{1} & 1 & 1 & 1 & 1 & 0 \\\hline \end{array}$

Since they have mentioned that the first fragment has an offset of $0$, the third fragment has an offset value of $144.$  

edited by

2 Comments

@Neelay Upadhyaya Awesome Work! :) 

1
1

thanks  Neelay Upadhyaya  brother

1
1
23 votes
23 votes

In diagram data at network layer is 4480 small mistake 

Number of fragments=4480/576= =8

Offset of third fragment = (0+576+576)/8 =144

Offset of fourth fragment = (0+576+576+576)/8 =216 and so on..

Hence 144 is correct answer

edited by

1 comment

can you please explain me how did you got  data of size 4460 at network layer ?
0
0
3 votes
3 votes
IP length = 4500B. Payload = 4480B.

MTU = 600B.

So, max packet we can make here is: Header(20) + Payload (580). But the payload isn't a multiple of 8 here.

Hence legally the max packet here is: Header(20) + Payload(576).

Seven such packets make up a total payload of 4032B.

 

So, last packet would be Header(20) + Payload (448).

 

Offset of first packet = 0.

Offset of second packet = 576B = 72

Offset of third packet = 72 + 72 = 144.
Answer:

Related questions