The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+25 votes
4.9k views

In an IPv4 datagram, the $M$ bit is $0$, the value of $HLEN$ is $10$, the value of total length is $400$ and the fragment offset value is $300$. The position of the datagram, the sequence numbers of the first and the last bytes of the payload, respectively are:

  1. Last fragment, $2400$ and $2789$
  2. First fragment, $2400$ and $2759$
  3. Last fragment, $2400$ and $2759$
  4. Middle fragment, $300$ and $689$
asked in Computer Networks by Veteran (357k points)
edited by | 4.9k views
0
Hi @Arjun Sir there is no sequence number field in IPV4 . It should be changed to fragment offset  , that too before diving by 8
0
ALWAYS 4 WILL BE THE SCALING FACTOR IN THE HLEN FIELD?

5 Answers

+42 votes
Best answer

$M=0$ meaning no more fragments after this. Hence, its the last fragment.

IHL = internet header length = $10 \times 4 = 40B$ coz $4$ is the scaling factor for this field.
Total Length = $400B$
Payload size = Total length - Header length = $400 - 40 = 360B$

fragment offset = $300 \times 8 = 2400B$ = represents how many Bytes are before this. $8$ is the scaling factor here.
$\therefore$ the first byte # = $2400$

Last byte # = first byte # + total bytes in payload - 1 = $2400 + 360 - 1 = 2759$

Option C is correct.

answered by Boss (30.8k points)
edited by
0
You have assumed that sequence number has started from 0 for 1st Byte of first fragment but as for as I know sequence number is allotted randomly. So, we can only be sure that difference between sequence number for first Byte and last Byte must be 359. We can't surely tell that it must start with 2400.
Please, do reply me if I get it wrong.
0

@amar u are saying that 2400 represents how many Bytes are before this.. then how come it becomes the first byte..?

plzz answer...

+1
2400 is the first byte of the last packet.
0
@Nitesh Tripathi what you mention is the case at Transport layer.
0
BUT sequence number is given to every byte of the data which doesn't include header bytes of tcp too??
0
Offset given is 300 which means (300*8=2400)2400 bytes are ahead of that packet, and in one packet we can store 360 bytes after removing header of 40 bytes as total length is 400 bytes but 2400 is not multiple of 360 so how can we divide packets?
0
why 8 is scaling factor here??
+22 votes
payload =total length-header

             =400-40

              =360

M bit is 0 so it is last fragment

offset is 300

so packet's first bit  300*8=2400

last bit =2400+359=2759

so ans is c
answered by Boss (31.7k points)
+3
You have assumed that sequence number has started from 0 for 1st Byte of first fragment but as for as I know sequence number is allotted randomly. So, we can only be sure that difference between sequence number for first Byte and last Byte must be 359. We can't surely tell that it must start with 2400.
Please, do reply me if I get it wrong.
0
@arjun sir @pooja could you please tell me why payload is taking initial bits instead of header. Header should take first 40 bytes here then the payload. Are we assuming according to the options given?
0

I think range of sequence number must cover 360 byte. For the last fragmented packet offset range would be 300 - 344 ]. So offset field contains number = 300. Only option C satisfies both the conditions of last fragment (MF = 0) and total 360 Byte (400-10*4 byte).i.e. possible sequence number can be [ 2400 - 2759 ] . That's why option C. I don't think initial sequence number assumption (as zero) is valid always. correct if wrong !

What if option C is given as = Last fragment,5000 and 5359. is it correct too ?

+16 votes

there is a similar problem has been given in "Forouzan book" 

http://erdos.csie.ncnu.edu.tw/~ccyang/TCPIP/TCPIPSlide.html

answered by Loyal (8k points)
+5 votes
Since M=0; It is indication of last fragment.

Data length=Total Length-header length

Data length=400-10*4=360

Fragments offset=300

Number of data byte ahead from this fragments is=300*8=2400

Last byte of last frame is=2400+360=2760

Last byte=2759(Because we starting our counting from 0---5---59)
answered by Loyal (8.9k points)
0
I think it is silly doubt but it should be clear.

Can you please tell me why we are not taking header length equal to 10 since it is given in the question ?
0

@Shubhanshu

The reason is Header length is number of 32 bit words. So header length = 10 * 4 = 40 

0
I think 10 means number of 4 bytes i.e 32-bit rows in the header is equal to 10

hence we are getting 10 * 4 = 40byte?
0
yes,correct
+3 votes
ans c)
answered by Loyal (5.2k points)
0
m=0 , means no more fragments following,

hlen=10 : so header length =10*4 bytes

so (c) is correct
Answer:

Related questions



Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

39,848 questions
46,813 answers
141,150 comments
59,062 users