309 views | 309 views
+2
280 ??
0
@joshi should be $180$, last fragment will contain $20B$ of payload and rest $9$fragments  will contain $160B$each i.e $9 \times 160 B=1440B$

last fragment has $\frac{160*9}{8}=180 B$  offset why you are adding $100$?
0
when initially packet arrived, it was having fragment offset= 100, so total payload ahead of last packet = 160*9 + 800
0
there will be total of $10 fragments$.we have to find the offet of the last fragment i.e $10^{th}$ fragment.

Offset of $10^{th}$ fragment=number of byte that has been send/ahead of $10^{th}$  fragment.

$\Rightarrow$ we have to find total byte send by all the 9 fragments $\Rightarrow 9 \times 160=1440B$

$\Rightarrow$applying scaling factor$=\frac{1440}{8}=180$

I am not getting which initial $100$ offset you are talking about
+1

@sourav.

i am taking these lines from qsn itself

HLEN value is 10 and offset value is 100 .

this means 100*8 = 800 bytes of data was ahead initially, even before whole fragmentation procedure starts, you have to add these 800 bytes also because it was ahead initially and will be ahead now also after fragmentation has been done..

0
okk thank you , actually i missed this offset value(already given ) from the question.
+1

@sourav

The datagram which router has received is a fragment that's why it has an offset of 100 means 800 bytes are already ahead of this fragment.

You can read fragmentation of fragment for more reference. +1
Thank you ashwani ,actually i did not see the qstn properly (did not see that 100 is already given) , so i had diiferent answer from tha tof $280$.Rest is ok.
0
Is it not mandatory for the last fragment to be multiple of 8?

Lets say data packet is 500 Bytes and MTU is 200 Bytes, with 20 Bytes header.

Will the data part be divided as 176+176+152(rounding off to multiple of 8) or 176+176+148(keep last fragment as it is, no padding) ??
0

@Ashwani Kumar 2

here why do we need scaling factor for header?

0

Given , total length of packet   =  1500 B

header length               =  10 * 4   =  40 B [ As HLEN field value = 10 ]

So payload (data) length   =   1500  -  40   =  1460 B

Now fragmentation is done into fragment sizes of 200 B [ As MTU of router given =  200 B ]

We should know that the header of packet is there in each fragment with some changes e.g. in flags and offset fields..

So payload length  in each fragment   =   200  -  40   =   160 B

Hence number of offsets in each fragment  =  160 / 8    =  20

Now as 160 is a multiple of 8 , hence it is allowed as it is else we have to take nearest multiple of 8 which is less than 160..To accomodate this , we do padding in last fragment..Payload in each fragment should be a multiple of 8 because 1 offset = 8 bytes by convention..

So number of fragments needed   =  ceil ( 1460 / 160 )   =  10

Hence offset of last fragment       =  Offset of 1st fragment + (number of fragments - 1) * (no of offsets in each fragment)

=  100  +  9 * 20

=   280

Hence offset of last fragment        =   280

by Veteran (101k points)
selected
0

offset of last fragment       =  Offset of 1st fragment + (number of fragments - 1) * (no of offsets in each fragment)

Why the offset of 1st fragment(old offset value) is added ?

+1
Offset is just like an index in the array..If the start index of the array is  100(say) , so we need to calculate subsequent offsets accordingly..
0
offset of first fragment is always 0 right
0
In the above formula, no of offsets in each frame is dependent on the MTU, we cannot say whether the number of  offsets reamins equal through out.